[R] A way to list only variables or functions?

Patrick Connolly p.connolly at hortresearch.co.nz
Wed Jun 23 23:29:12 CEST 2004


On Mon, 21-Jun-2004 at 03:50PM +0100, Barry Rowlingson wrote:

|> Duncan Murdoch wrote:
|> 
|> 
|> > I seem to recall that S-PLUS has such a function, but I forget the
|> > name of it.   Probably R does too, on CRAN if not in the base
|> > packages.
|> 
|> objects.summary() I think it was.
|> 
|> It always bothered me that the Nth thing you teach Unix users is 'ls' 
|> and the N+1th thing is 'ls -l' (for very small N). Then you teach them 
|> R, and there's no 'ls -l' equivalent immediately obvious.
|> 
|>   Not sure what such a function could show, there being no permissions, 
|> or dates on R objects, but object.size() and class/mode at least would 
|> be useful.
|> 
|>   So is something like this in CRAN? I say +1 to putting it in the base 
|> packages....

I hesitate to mention it again.  Last time I did there was minimal
interest.  However, the question has been asked again, so perhaps now
is different....

I made myself a function in the S-PLUS days which I've modified to
work in R.  It involved adding another few functions to add dates to
objects.

This is the sort of output it gives:

        Object         Mode   Rows Cols Len    Date   
 1 last.warning     list       --   --    1 NA/NA/NA  
 2 sim.notuff17C.df dataframe  100  9     9 09/06/2004
 3 box.sim          function   --   --    1 04/06/2004
 4 box.simC         function   --   --    1 04/06/2004
 5 multi.sim        function   --   --    1 04/06/2004
 6 multi.simC       function   --   --    1 04/06/2004
 7 sim.100B         function   --   --    1 04/06/2004
 8 sim.100C         function   --   --    1 04/06/2004
 9 sim.100.df       dataframe  100  9     9 04/06/2004
10 sim.notuff17.df  dataframe  100  9     9 04/06/2004
11 sim.notuff.df    dataframe  100  9     9 04/06/2004
12 sim.tuff.df      dataframe  100  9     9 04/06/2004
13 aa               numeric    100  9   900 03/06/2004
14 sim.100A         function   --   --    1 03/06/2004
15 sim.100          function   --   --    1 01/06/2004
16 develop.df       dataframe  161  7     7 28/05/2004
17 glm.both         function   --   --    1 24/05/2004
18 lm.gall          function   --   --    1 24/05/2004
19 aphidgall.df     dataframe  79   4     4 12/05/2004
20 pears.gall       function   --   --    1 13/11/2003
21 glm.gallEPS      function   --   --    1 27/08/2003

I've toyed with the idea of adding an object size column but it's not
important enough for my use.  Since I revisit projects over a period
of years at times, the date is very useful information -- in fact,
it's the main reason why I wrote it.

My code is not elegant enough for an esteemed place on CRAN.  I could
make it a lot better myself if I spent the time on it, but it works
well enough for me as it is, so in that sense, it ain't broke.
However, if anyone is interested in having such functionality my code
could be a good starting point.

Best

-- 
Patrick Connolly
HortResearch
Mt Albert
Auckland
New Zealand 
Ph: +64-9 815 4200 x 7188
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~




More information about the R-help mailing list