[R] How to open only one file in a .gz file?

Yihui Xie xieyihui at gmail.com
Sun Sep 27 19:41:22 CEST 2009


gzfile() can handle a single file in *.gz. If you want to read one of
the files in a bunch of files, you may as well extract them first
using "tar -zxvf yourarchive.tar.gz" (sounds like a stupid solution),
or if you only want to use R, system() could help, e.g. system("tar
-zxvf yourarchive.tar.gz"). You didn't tell us sessionInfo(), so I'm
not sure whether you are able to use the "tar" command.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-6609 Web: http://yihui.name
Department of Statistics, Iowa State University
3211 Snedecor Hall, Ames, IA



2009/9/27 Uwe Ligges <ligges at statistik.tu-dortmund.de>:
>
>
> Peng Yu wrote:
>>
>> Hi,
>>
>> Suppose that there are multiple files in a .gz file.
>
> Well, the extension .gz regularly stand for a (single) gzip compressed file.
> Tyoically you will find more tan one file in a tar archive or a zip
> compressed archive. For the latter see ?unz.
>
> Uwe Ligges
>
>
>
>> How to open only
>> one file in it? I don't find such options in the help.
>>
>> Regards,
>> Peng
>>




More information about the R-help mailing list