[R] opening a WinZip file
Marsland, John
John.Marsland at CommerzbankIB.com
Tue Oct 14 10:09:20 CEST 2003
I use the following to read files from inside a .zip file directly:
z <- unz("C:/temp/my.zip", "/the/full/path/my.csv", open="r")
mydata <-
read.csv(z,skip=4,header=F,as.is=T,colClasses=c("character","character"))
close(z)
obviously you should use whatever options are appropriate with read.csv
but the important thing is to reference the full saved path of the file
within the zip file.
This works fine, but there is an intermitent "bug" about seek not working on
this connection - if you re-run it alwys goes away.
Regards,
John
> -----Original Message-----
> From: Adam Langley [mailto:AdamL at spc.int]
> Sent: 13 October 2003 23:20
> To: r-help at stat.math.ethz.ch
> Subject: [R] opening a WinZip file
>
>
> Hello
>
> I am trying to read a large number of WinZip files from
> inside R (v 1.7.1,
> options()$unzip = internal). I have unsuccessfully tried to
> unpack the files
> and write to an external directory so that I could read the
> text files using
> zip.unpack. Reading some of the archives suggests that this
> is for .ZIP
> format files only.
>
> I have also unsuccessfully tried to use gzfile to open a
> connection and then
> read.
>
> Any suggestions?
>
> Thanks in advance.
>
> Adam
>
> ------------------------------------------------------------------
> Adam Langley
> Principal Fisheries Scientist
> Oceanic Fisheries Programme
> Secretariat of the Pacific Community
> BP D5, 98848 Noumea Cedex, New Caledonia
> Tel: +687 262 000 (Ext. 192)
> Fax: +687 263 818
>
>
>
>
> ---
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
**********************************************************************
This is a commercial communication from Commerzbank AG.\ \ T...{{dropped}}
More information about the R-help
mailing list