Hi, Suppose that I have a csv file that is compressed with zip, is there a way to read it in R without first decompressing it to a file. Regards, Peng
If you have the 7z zip utility and are on Windows (or use 7z and grep on UNIX): DF <- read.csv(pipe("7z x myfile.zip -so | findstr $")) On Tue, Sep 22, 2009 at 9:30 PM, Peng Yu <pengyu.ut at gmail.com> wrote:> Hi, > > Suppose that I have a csv file that is compressed with zip, is there a > way to read it in R without first decompressing it to a file. > > Regards, > Peng > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
No. My machine is a linux machine. On Tue, Sep 22, 2009 at 9:02 PM, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:> If you have the 7z zip utility and are on Windows > (or use 7z and grep on UNIX): > > DF <- read.csv(pipe("7z x myfile.zip -so | findstr $")) > > > On Tue, Sep 22, 2009 at 9:30 PM, Peng Yu <pengyu.ut at gmail.com> wrote: >> Hi, >> >> Suppose that I have a csv file that is compressed with zip, is there a >> way to read it in R without first decompressing it to a file. >> >> Regards, >> Peng >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >
Linux is a type of UNIX so follow the instructions I gave for UNIX. On Tue, Sep 22, 2009 at 10:16 PM, Peng Yu <pengyu.ut at gmail.com> wrote:> No. My machine is a linux machine. > > On Tue, Sep 22, 2009 at 9:02 PM, Gabor Grothendieck > <ggrothendieck at gmail.com> wrote: >> If you have the 7z zip utility and are on Windows >> (or use 7z and grep on UNIX): >> >> DF <- read.csv(pipe("7z x myfile.zip -so | findstr $")) >> >> >> On Tue, Sep 22, 2009 at 9:30 PM, Peng Yu <pengyu.ut at gmail.com> wrote: >>> Hi, >>> >>> Suppose that I have a csv file that is compressed with zip, is there a >>> way to read it in R without first decompressing it to a file. >>> >>> Regards, >>> Peng >>> >>> ______________________________________________ >>> R-help at r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
and note that if, instead of zip files, you were using gzip files, you could: conn <- gzfile("file.gz", "rt") theData <- read.table(conn) close(conn) b On Sep 22, 2009, at 11:21 PM, Gabor Grothendieck wrote:> Linux is a type of UNIX so follow the instructions I gave for UNIX. > > On Tue, Sep 22, 2009 at 10:16 PM, Peng Yu <pengyu.ut at gmail.com> wrote: >> No. My machine is a linux machine. >> >> On Tue, Sep 22, 2009 at 9:02 PM, Gabor Grothendieck >> <ggrothendieck at gmail.com> wrote: >>> If you have the 7z zip utility and are on Windows >>> (or use 7z and grep on UNIX): >>> >>> DF <- read.csv(pipe("7z x myfile.zip -so | findstr $")) >>> >>> >>> On Tue, Sep 22, 2009 at 9:30 PM, Peng Yu <pengyu.ut at gmail.com> >>> wrote: >>>> Hi, >>>> >>>> Suppose that I have a csv file that is compressed with zip, is >>>> there a >>>> way to read it in R without first decompressing it to a file. >>>> >>>> Regards, >>>> Peng >>>> >>>> ______________________________________________ >>>> R-help at r-project.org mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>> >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.