[R] reading file in zip archive
Phil Spector
spector at stat.berkeley.edu
Wed May 30 21:16:03 CEST 2012
Iain -
Once you specify the file to unzip in the call to unz, there's no
need to repeat the filename in read.table. Try:
z <- unz(pathToZip, 'goCats.txt', 'r')
zT <- read.table(z, header=TRUE, sep='\t')
(Although I can't reproduce the exact error which you saw.)
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spector at stat.berkeley.edu
On Wed, 30 May 2012, Iain Gallagher wrote:
> Hi List
>
> I have a series of zip archives each containing several files. One of these files is called goCats.txt and I would like to read it into R from the archive. It's a simple tab delimited text file.
> pathToZip <- '/home/iain/Documents/Work/Results/bovineMacRNAData/deAnalysis/afInfection/commonNorm/twoHrs/af2hrs.zip'
>
> z <- unz(pathToZip, 'goCats.txt', 'r')
> zT <- read.table(z, 'goCats.txt', header=T, sep='\t')
>
> Error in read.table(z, "goCats.txt", header = T, sep = "\t") :
> ? seek not enabled for this connection
>
>
> The same error arises with readLines.
>
> Can anyone advise?
>
> Best
>
> iain
>
>> sessionInfo()
> R version 2.15.0 (2012-03-30)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
> ?[1] LC_CTYPE=en_GB.utf8?????? LC_NUMERIC=C????????????
> ?[3] LC_TIME=en_GB.utf8??????? LC_COLLATE=en_GB.utf8???
> ?[5] LC_MONETARY=en_GB.utf8??? LC_MESSAGES=en_GB.utf8??
> ?[7] LC_PAPER=C??????????????? LC_NAME=C???????????????
> ?[9] LC_ADDRESS=C????????????? LC_TELEPHONE=C??????????
> [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C?????
>
> attached base packages:
> [1] stats???? graphics? grDevices utils???? datasets? methods?? base????
>
> loaded via a namespace (and not attached):
> [1] tools_2.15.0
> [[alternative HTML version deleted]]
>
>
More information about the R-help
mailing list