[R] read zips

Mark Myatt mark at myatt.demon.co.uk
Thu Jan 31 11:46:11 CET 2002


Heberto Ghezzo <heberto.ghezzo at mcgill.ca> writes:
>Hello, I have to read ASCII files with readLine. Some of these files are
>big. I receive these files in zip format, then unzip and read into R to
>process.
>Is it possible to read directly the Zip file? Help is zipped so the
>tools to unzip while reading are there, is it possible to use them from
>my package?

You can to extract the files from within R and then use readLines() or
whatever to read them. I think you can use zip.file.extract() but this
function is internal and not stable. On Windows you can use
zip.unpack(). Another approach is to call the unzipper with shell() or
system().

The function gzfile() was, I think, introduced in v1.3.0 and allows
reading and writing to gzipped files. I think you need to have gzip
installed (all Linux systems should have this installed by default or
you would not be able to install compressed tarballs). I have not used
this function so I cant tell you if there are any oddities.

Mark

--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list