1 Feb 02:00
Re: how to unzip files in R
Henrik Bengtsson <hb <at> biostat.ucsf.edu>
2012-02-01 01:00:08 GMT
2012-02-01 01:00:08 GMT
I may be wrong, but I don't think unz() handles bz2 files - only zip files.
See bunzip2() of the R.utils package (which utilizes bzfile connections).
/Henrik
On Tue, Jan 31, 2012 at 2:34 PM, ql16717 <ql16717 <at> gmail.com> wrote:
> Hi,
>
> I have downloaded a bunch of bz2 files. I wonder if R will be able to
> unzip them in a batch mode or even one at a time?
>
> I was looking at the unz function. But it didn't work well. Say I have
> a bz2 file in H:/Temp/65502805_532.pair.bz2. Anyone has any
> suggestion?
>
> thanks
> John
>
>> setwd("H:\\Temp\\")
>> getwd()
> [1] "H:/Temp"
>> fn<-list.files(pattern="bz2", full.names=TRUE)
>> fn
> [1] "./65502805_532.pair.bz2"
>> unz(description=fn, filename="65502805_532.pair", open="r")
> Error in unz(description = fn, filename = "65502805_532.pair", open = "r") :
> cannot open the connection
> In addition: Warning message:
> In unz(description = fn, filename = "65502805_532.pair", open = "r") :
(Continue reading)
RSS Feed