[R] names of objects in .rda

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri May 11 19:31:04 CEST 2007

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 

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

More information about the R-help mailing list