This is too bad (and an old bug at least since 0.49); it also breaks some code I have been using in S-plus:> tst <- function(...) ls(...)> tst()#--- should really give the same as ls() !!character(0)> ls()[1] "%in%" "As.integer" "Dir" [4] "Dir0" "Fn12" "Slynx" ...... =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Martin Maechler <maechler@stat.math.ethz.ch> writes:> > This is too bad (and an old bug at least since 0.49); > it also breaks some code I have been using in S-plus: > > > tst <- function(...) ls(...) > > > tst()#--- should really give the same as ls() !! > character(0) > > > ls() > [1] "%in%" "As.integer" "Dir" > [4] "Dir0" "Fn12" "Slynx" > ......I don't know whether it's a bug or a feature, but it has nothing to do with (...)> tst<-function()ls() > tst()character(0)> ls()[1] "NextMethod" "airquality" "dig" "grid" "l" [6] "tst" "umach" "x" "xmin" "y" [11] "z" "æøå"> tst<-function(...){x<-5;ls(...)} > tst()[1] "x"> tst<-function(){x<-5;ls()} > tst()[1] "x" I'm rather suspecting that pos=-1 in the argument list to ls should have been pos=1. Anyone have the big picture on pos and envir? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This is a "feature" of ls(). When invoked with no arguments it returns the list of variables \emph{in the environment it is called from}. This is to make it useful in conjunction with debug() and browser(). It allows you find out what the current local variables are. To get the same effect as a top level ls(), you must expicitly do ls(pos=1) # may fail if we allow attaching at pos=1 ls(envir=.GlobalEnv) # safer Ross =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Apparently Analagous Threads
- help with the coordinates of the ECDF object
- slanted ends of horizontal lines for certain line widths
- More precision problems in testing with Intel compilers
- Why does "rsync -av" always claim (incorrectly?) that it is updating write protected directories?
- Samba 3 handles Linux permissions differently then Samba 2 ?