Re: [R] names of objects in .rda

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Fri, 11 May 2007 18:31:04 +0100 (BST)

On Fri, 11 May 2007, Benilton Carvalho wrote:

> Hi everyone,
>
> sorry if this was discussed before (and in this situation, could you
> please point me to the discussion in the archive? My search didn't
> seem to be effective).
>
> Is there a way of getting the names of objects in a .rda file without
> having to load it?

Well, of course there is a way (R has ways to read datafiles from other packages, and similarly one could write a .rda reader from the description in 'R Internals').

First, .rda files exist in several different formats, so you would have to open it to get the format or assume the most recent format.

Second, the internal structure is as a pairlist (a pairlist is constructed and that single object saved), and you are asking for the tags of the pairlist. Those are distributed throughout the file, so you would need to know a great deal about the structure to read the file without making use of R's internals.

I wonder what motivates the question: loading into a new enviroment is pretty painless and returns a character vector of object names. It is possible that the file would be too big to do so, but then knowing what is in it is not going to help as there is no way to extract just part of it (and R objects are not in any case self-contained and may share sub-objects).

-- 
Brian D. Ripley,                  ripley_at_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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 11 May 2007 - 17:40:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 May 2007 - 18:31:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.