[R] R GUI and object browser

Patrick Connolly p.connolly at hortresearch.co.nz
Mon Jul 15 00:03:41 CEST 2002


On Fri, 12-Jul-2002 at 08:28AM +0200, Martin Maechler wrote:

|> >>>>> "PaCo" == Patrick Connolly <p.connolly at hortresearch.co.nz> writes:
|> 
|>     PaCo> On Thu, 11-Jul-2002 at 07:58PM -0400, Mike Prager wrote:
|>     PaCo> |> At 10:37 AM 07/11/2002 +0200, Philippe Grosjean wrote:
|>     PaCo> |> >Several users noticed that the only part of the Splus GUI they
|>     PaCo> |> >use is the object explorer. So, wouldn't an R object explorer be a good
|>     PaCo> |> >addition to the current interface?
|>     PaCo> |> 
|>     PaCo> |> Yes!  I hope the core development team will consider it.
|> 
|>     PaCo> It's not very difficult to write a function that lists your objects in
|>     PaCo> a dataframe along with the sort of information you'd like to see.  I
|>     PaCo> personally like to know the size of dataframes so it was simple to
|>     PaCo> make columns that shows the dimensions.  It was somewhat trickier to
|>     PaCo> get the date but I like to have it, so I did it.  
|> 
|>     PaCo> My current directory has things like this in it:
|> 
|>     PaCo> Object        Mode   Rows Cols Len    Date   
|>     PaCo> 1 fmr.pvh2000    function  --    --   1  12/07/2002
|>     PaCo> 2 last.warning   list      --    --   5  12/07/2002
|>     PaCo> 3 pvh.latto2000  function  --    --   1  09/07/2002
|>     PaCo> 4 pvh.latto2000A function  --    --   1  09/07/2002
|>     PaCo> 5 rain.plot2000  function  --    --   1  09/07/2002
|>     PaCo> 6 accum2000      function  --    --   1  04/07/2002
|>     PaCo> 7 pvh.latto4     function  --    --   1  04/07/2002
|>     PaCo> 8 side.df        dataframe 1000  5    5  04/07/2002
|> 
|> quite nice!
|> 
|> Note:
|> 
|>   ls.str()  
|>   ~~~~~~~~
|> 
|> may be an under used feature of R, at least since version 0.5 or so;
|> it does provide a bit more output than the above and 
|> does *not* provide the date. 

That could be quite useful.  I'd never noticed it before.



|> 
|> For quite some reason: 
|> I believe that most of the experienced S users (including the R
|> ones) keep things in scripts and packages -- if only for the
|> purpose of reproducible research and do not use .RData often
|> (I do never; I do save expensive results (mostly simulations) in *.rda
|> files that I attach() or load() explicitly, but that's all.
|> Everything else I recreate by running a script or loading a
|> private package.  --> hence `date' of an object would have to be
|> the date of the script where that object is defined which often
|> is not really interesting...
|> 
|>     PaCo> I wrote my function some years ago and could do it much better knowing
|>     PaCo> what I know now, but if someone wants to make something generally
|>     PaCo> available, mine might be a good starting point.
|> 
|> (so why didn't you append it, or make it available as URL ?)

To answer that will require some explanation which might be boring to
some, but here it is:

I first created my process back when I was using Splus 3.1 which keeps
objects as files which have a date.  One of the main shell commands I
use is ls -lat because I'm usually interested in the most recent files
in a directory I'm working on.  Using Splus, the habit carried over,
so I set about producing the same effect and I got very comfortable
working that way.  I limited the amount of information displayed so
that no more than one line was taken up by each object.  Over the
years, it became useful to know just how old a particular dataframe or
function was in addition to knowing just what were lists and other
types of objects.  I often revisit work years later, so that date
information is, more often than not, very useful to have.

When I moved to R, the habit was too hard to break, so I ported the
code across, adding the date as a comment to make it work.  Additional
fiddly processes were necessary to do that, but for me it was worth
the effort.

Using ESS, it's very simple to keep a file of the code that reads in
data and all the operations that are done by the functions that go
with that directory.  As well as keeping a record of what was done,
it's very simple to run a few lines again after data entry errors have
been corrected for example.  If you don't use ESS, it probably would
not be so simple.  Comment lines are useful to document just what the
thinking was behind the various steps.  It's also simple to make a
procedure to write a text file of the code that goes into each
function so that they can be resurrected if necessary.  I only
occasionally make a special file instead of .RData -- usually if there
are some very large data frames, large numbers of objects, or
"sensitive" simulations.

My method might not be usable by Windows users and involves more than
just a function.  Perhaps I was a bit misleading when I stated that it
was simple to make a function.  I wasn't referring to the use of the
date in that statement.  My 'simple' function would still use a number
of my local functions so providing it is not a single step either.

I mentioned it some time ago, but hardly anyone seem to think it was
the useful utility I think it is.  Because of the lack of interest, I
didn't tidy it up to be more transportable.  It works fine how it is
for me so it needs no changes.  

The discussion about the object browser brought me to mentioning it
again in case times had changed.  It would need testing to see if it
works with Windows also and I have no inclination to do that.  I'm not
sure it would be still be simple outside ESS.  If someone is
interested in making such a utility generally available, the offer is
there.

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 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~


______________________________________________________
The contents of this e-mail are privileged and/or confidential to the
named recipient and are not to be used by any other person and/or
organisation. If you have received this e-mail in error, please notify 
the sender and delete all material pertaining to this e-mail.
______________________________________________________
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list