[R] What is the fastest way to see what are in an RData file?
Gustaf Rydevik
gustaf.rydevik at gmail.com
Fri Dec 18 10:33:26 CET 2009
On Thu, Dec 17, 2009 at 4:33 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
> On Thu, Dec 17, 2009 at 5:33 AM, Gustaf Rydevik
> <gustaf.rydevik at gmail.com> wrote:
>> On Wed, Dec 16, 2009 at 10:13 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
>>>
>>> Currently, I load the RData file then ls() and str(). But loading the file
>>> takes too long if the file is big. Most of the time, I only interested what
>>> the variables are in the the file and the attributes of the variables (like
>>> if it is a data.frame, matrix, what are the colnames/rownames, etc.)
>>>
>>> I'm wondering if there is any facility in R to help me avoid loading the
>>> whole file.
>>
>>
>> I thought this was interesting as well, so i did a bit of searching
>> through the R-help list archives and found this answer by Simon
>> Urbanek:
>> https://stat.ethz.ch/pipermail/r-devel/2007-August/046724.html
>> The link to a c-routine that does what you want still works, but for
>> future reference I'm pasting the code below.
>
> It doesn't work for the RData file that I saved by "save(list='test',
> file='test.RData')".
>
> $ rdcopy test.RData
> Format version 3ec, R version = 23813.88.84, release = f9db1dba
> Sorry, this tool supported RXDR version 2 format only
>
What happens if you remove the version check?
I.e. this one:
if (ver != 2) {
XdrInTerm(d);
error(_("Sorry, this tool supported RXDR version 2 format only\n"));
}
>From what I can read on the hel page for ?save, there hasn't been a
change in the file format since 1.4.0....
/Gustaf
--
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik
More information about the R-help
mailing list