[R] how to unzip files in R
ql16717
ql16717 at gmail.com
Tue Jan 31 23:34:41 CET 2012
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") :
cannot open zip file './65502805_532.pair.bz2'
> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] pdInfoBuilder_1.18.0 oligo_1.18.1 oligoClasses_1.16.0
affxparser_1.26.2 RSQLite_0.10.0
[6] DBI_0.2-5 Biobase_2.12.1
loaded via a namespace (and not attached):
[1] affyio_1.22.0 Biostrings_2.22.0 bit_1.1-8
ff_2.2-4 IRanges_1.12.1
[6] preprocessCore_1.16.0 splines_2.14.0 tools_2.14.0
zlibbioc_1.0.0
More information about the R-help
mailing list