[R] read zipped files

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Feb 4 19:20:56 CET 2002


On Mon, 4 Feb 2002, Heberto Ghezzo wrote:

> I received several answer to my querry re reading zipped files,
> R.Gentleman, Liaw Andy, BD Ripley,J Holtman, A.Matt, and others,
> sorry
> if I missed your names.
> a- use pipe to run external unzip to a file and read from there
> b- use gzfile() to open directly a gzipped file
> c- use zip.file.extract()
> solution b works like a charm, unfortunately it open gzipped files
> and
> not zipped files, would it be possible in a future release to add
> a
> zipfile() function?

It's called unz(), expect to see it in 1.5.0.

> solution c. There is a problem here a) the help says it can be
> changed

It will have a public interface come 1.5.0.

> at any moment b) it does not work in some platforms.
> Well it does not work in a Win98 machine with R1.4.0 The work
> inside
> zip.file.extract() is done by:
> rc <- .Internal(int.unzip(file.path(path,zipname),topic,tempdir))
> it return rc = 0 which I assume means OK

zip.file.extract returns a character string saying where it put it.
See, e.g. help for how it is used.

> but I can not find the unzipped file anywhere or using rc as file
> pointer.
> Can somebody tell me how to access the unzipped file, i.e."topic"
> How
> do I write txt <- readLines(pfile,n=2), what do I put instead of
> pfile?
> As always thanks to those who responded to my first querry
> --
> R. Heberto Ghezzo Ph.D.
> Meakins-Christie Labs
> McGill University
> Montreal  -  Canada
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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