[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@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.
Re: [R] names of objects in .rda
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 __ R-help@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.
Re: [R] names of objects in .rda
On 5/11/07, Benilton Carvalho [EMAIL PROTECTED] 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() __ R-help@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.
Re: [R] names of objects in .rda
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Benilton Carvalho Sent: Friday, May 11, 2007 11:54 AM To: [EMAIL PROTECTED] 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@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. __ R-help@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.
Re: [R] names of objects in .rda
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, [EMAIL PROTECTED] 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, UKFax: +44 1865 272595 __ R-help@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.
Re: [R] names of objects in .rda
Christos Hatzis [EMAIL PROTECTED] writes: An approach would be to attach it and then use ls() No, that really is not an approach. If you load it, then there is no problem to read the names. The point is not to load it. This is important when dealing with large objects or large collections of objects. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@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.
Re: [R] names of objects in .rda
You're right. I didn't realize that what happens when attaching is that a new environment is created on the search path and the elements of a list (including columns of a data frame) or objects in a save file or an environment are *** copied *** into the new environment Thanks. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Seth Falcon Sent: Friday, May 11, 2007 1:32 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] names of objects in .rda Christos Hatzis [EMAIL PROTECTED] writes: An approach would be to attach it and then use ls() No, that really is not an approach. If you load it, then there is no problem to read the names. The point is not to load it. This is important when dealing with large objects or large collections of objects. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@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. __ R-help@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.