[R] Data import export zipped files from URLs
Duncan Temple Lang
duncan at wald.ucdavis.edu
Tue Jan 19 13:58:17 CET 2010
Dieter Menne wrote:
>
> Velappan Periasamy wrote:
>> I am not able to import zipped files from the following link.
>> How to get thw same in to R?.
>> mydata <-
>> read.csv("http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip")
>>
>
> As Brian Ripley noted in
>
> http://markmail.org/message/7dsauipzagq5y36o
>
> you will have to download it first and then to unzip.
Well if downloading to disk first does need to be avoided, you can use
the RCurl and Rcompression packages to do the computations in memory:
library(RCurl)
ctnt = getURLContent("http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip")
library(Rcompression)
zz = zipArchive(ctnt)
names(zz)
txt = zz[[1]]
read.csv(textConnection(txt))
D.
>
> Dieter
>
>
More information about the R-help
mailing list