[R] What is the fastest way to see what are in an RData file?

Peng Yu pengyu.ut at gmail.com
Fri Dec 18 18:34:23 CET 2009


On Fri, Dec 18, 2009 at 3:33 AM, Gustaf Rydevik
<gustaf.rydevik at gmail.com> wrote:
> 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"));
>  }

I commented the above lines out. But it doesn't work.

$ rdcopy some.RData
Format version 314, R version = -25755.184.212, release = e6164617
ReadItem: unknown type 93, perhaps written by later version of Rp

> 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....




More information about the R-help mailing list