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? Thank you very much, benilton -- PhD Candidate Department of Biostatistics Bloomberg School of Public Health Johns Hopkins University
On 5/11/2007 11:53 AM, 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? > > Thank you very much,Not currently, but it would be a nice little project for someone to write that, and also code to help retrieve objects from a .rda file after it had been damaged and was no longer loadable by R. My normal advice would be not to use .rda files to save things, but sometimes the alternatives are not nearly as convenient. Duncan Murdoch
An approach would be to attach it and then use ls() attach(myarchive.rda) ls(pos=2) detach(myarchive.rda) -Christos Christos Hatzis, Ph.D. Nuvera Biosciences, Inc. 400 West Cummings Park Suite 5350 Woburn, MA 01801 Tel: 781-938-3830 www.nuverabio.com> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of > Benilton Carvalho > Sent: Friday, May 11, 2007 11:54 AM > To: r-help at lists.r-project.org server posting > Subject: [R] names of objects in .rda > > 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? > > Thank you very much, > > benilton > > -- > PhD Candidate > Department of Biostatistics > Bloomberg School of Public Health > Johns Hopkins University > > ______________________________________________ > 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. > >
On 5/11/07, Benilton Carvalho <bcarvalh at jhsph.edu> 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?Although it is not terribly different from loading an .rda file you can get the names of the objects via the sequence objects(attach("myRdaFile.rda")); detach()
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