Dear useRs,

Some time ago I queried the list as to an efficient way of building a function which acts as ls() but with a different default for all.names:

http://tolstoy.newcastle.edu.au/R/e6/help/09/03/7588.html

I have struck upon a solution which so far has performed admirably.  In particular, it uses ls() and not its explicit source code, so only has a dependency on its name and the name of its all.names argument.  Here is my solution:

lsall  <-  function(...) {

     thecall <- as.call(c(as.name('ls'), list(...)))
     newcall <- match.call(definition=ls, call=thecall)
     if( !('all.names' %in% names(newcall)) ) newcall[['all.names']] <- TRUE
     eval(newcall, envir=parent.frame())

   }#### end lsall

In my hands this function has always acted exactly as I expected, identically to ls() but with the default of all.names=TRUE (which can be overridden as usual).  In particular, it (i) gets the proper search path position right; (ii) works as expected within a browser() session.  I am sharing this in case someone finds this construction helpful for other purposes, and in case someone finds a failing case they then have the option of communicating it back here.

John

John  Szumiloski,  Ph.D.

Associate Principle Scientist, Biostatistics
Biometrics Research
WP53B-120
Merck Research Laboratories
P.O. Box 0004
West Point, PA 19486-0004
USA
(215) 652-7346 (PH)
(215) 993-1835 (FAX)
john<dot>szumiloski<at>merck<dot>com
___________________________________________________
These opinions are my own and do not necessarily reflect that of
Merck & Co., Inc.





Notice:  This e-mail message, together with any attachme...{{dropped:14}}

