[R] write.zip?
spencerg
spencer.graves at prodsyse.com
Wed Feb 10 17:23:21 CET 2010
Thanks to Dieter Menne and Prof. Ripley for replies.
For certain definitions of "better" (e.g., transportability?), the
Rcompression package might be superior to the system call I mentioned.
I also just found the "tar" function in the "utils" package, which looks
like it might be more transportable than my system call.
However, as Prof. Ripley noted, there may not be a "simpler" way
than my system call, especially considering the time I would have to
invest to learn how to use it.
Thanks again very much,
Spencer Graves
Prof Brian Ripley wrote:
> On Tue, 9 Feb 2010, spencerg wrote:
>
>> Can one write a zip file from R?
>> I want to create a file with a name like "dat.zip", being a zip
>> file containing "dat.csv". I can create "dat.csv", then call
>> "system('zip -r9 dat.zip dat.csv')". Is there a better way?
>
> Not really. One could use compiled code like that in unzip() to do
> this, but as nothing inside R is involved the only gain would be to
> not need to have the zip executable present. Omegahat package
> Rcompression does have means to manipulate .zip files from compiled
> code with an R interface, but not AFAICS a simpler way to do what you
> want.
>
>> I can use "gzfile" to write a gz file, but I don't know how to
>> give that a structure that would support unzipping to a *.csv file.
>
> A zip file is not a gzipped file, even though gzip compression is used
> for parts of the contents. The header and trailer are quite different.
>
>>
>> Thanks,
>> Spencer
--
Spencer Graves, PE, PhD
President and Chief Operating Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph: 408-655-4567
More information about the R-help
mailing list