[R] gzfile() produces large files
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Jun 27 16:11:37 CEST 2001
On Wed, 27 Jun 2001, Uwe Ligges wrote:
> I observed some strange results playing around with gzfile() [R-1.3.0,
> WinNT 4.0]:
>
> At first
>
> x <- 1:1000
> write(x, file = "c:/temp.txt")
>
> results in a file of about 4 kB. But
>
> my.con <- gzfile("c:/temp.gz", open = "w")
> write(x, file = my.con)
> close(my.con)
>
> results in a file of about 16 kB.
>
> I expected a reduction of the size. Anyone who can tell me what went
> wrong?
My experiments concur: I do get a 15913 byte file and it is a valid gzip
file.
I've used this much more to read compressed files than write them.
I will take a closer look at the zlib specs when I have time.
Brian
--
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