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? Thanks -- R. Heberto Ghezzo Ph.D. Meakins-Christie Labs McGill University Montreal - Canada -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 30 Jan 2002, Heberto Ghezzo wrote:> 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?Yes. ?zip.file.extract but note the warnings. -- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Heberto Ghezzo wrote:> > 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? > ThanksIf you can use gzip (under Unix, Windows?, Mac?) you can open the file with gzfile(). By, Sven -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._