On Mon, 18 Nov 2002, Leonid Gibiansky wrote:
> I found some strange behavior of S+ 2000 Release 1 Professional and I
> would be grateful for the explanation:
>
> I have a command-line interactive program (xpose3 for those who is familiar
> with the program) that uses a variable runno.
Is this an S function, or really a command-line program? (Sounds more
like the first.)
> I also happen to use the same
> name in my script that I am using from the script window. Then attempts to
> change runno from the script window do not give any warning and do not
> change runno (but lead to hidden errors in my script that uses the data
> associated with the incorrect runno):
>
> > runno <- 102
> > runno
> [1] "101"
>
>
> When I exited xpose3, I got a message on exit:
>
> Warning messages:
> "runno" assigned on database 1 but hidden by an object of the same name
> on database 0
>
> Now when I am trying to change runno I am getting:
>
> > runno <- 102
> > runno
> [1] "101"
> Warning messages:
> "runno" assigned on database 1 but hidden by an object of the same name
> on database 0
>
> When I open runno via Object Explorer, I see "102" there.
>
> It looks like S+ is writing runno into one place, but reading it from
> another one. Is it expected behavior or a bug ? Is it possible to change it ?
It's a bug, but not in S. Something you have used has done
assign("runno", 101, w=0) or the equivalent. Now, people should not mess
with the session database (w=0) without documenting it, but equally it is
inadvisable to run S code you don't understand.
Try find("runno").
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
|