______________________________________________
R-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
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.
Dieter
--
View this message in context: http://n4.nabble.com/Data-import-export-zipped-files-from-URLs-tp1017287p1017326.html
Sent from the R help mailing list archive at Nabble.com.
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
http://ryacas.googlecode.com/svn/trunk/R/yacasInstall.R
from the Ryacas package. It downloads, unzips and installs yacas and
associated files for Windows users.
> mydata <- unzip("http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip")
Warning message:
In unzip("http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip")
:
error 1 in extracting from zip file
f <- tempfile()
download.file("http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip",
f)
myData <- read.csv(unzip(f))
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
f <- tempfile()
download.file("http://nseindia.com/content/equities/scripvol/datafiles/01-01-2010-TO-23-01-2010RCOMXN.csv",
f)
myData <- read.csv(f)
See the code again.
the url is correct. it is not zipped file.
copy the url in the browser window you will get the
this ......
Symbol,Series,Date, Prev Close,Open Price,High Price,Low Price,Last
Price,Close Price,Average Price,Total Traded Quantity,Turnover in
Lacs,
RCOM,EQ,04-Jan-2010,172.35,173,175.8,172.55,175.25,175.2,174.17,2418999,4213.1160435,
RCOM,EQ,05-Jan-2010,175.2,176,182,175.8,181.45,181.35,178.64,6033757,10778.7459905,
RCOM,EQ,06-Jan-2010,181.35,182.5,184.4,180.8,181.5,181.8,182.76,4680776,8554.525768,
RCOM,EQ,07-Jan-2010,181.8,183.7,185.3,182.5,183.8,183.9,184.05,4255338,7831.773937,
RCOM,EQ,08-Jan-2010,183.9,184.5,185.15,180.2,181.1,180.85,182.14,3775898,6877.5970215,
RCOM,EQ,11-Jan-2010,180.85,184,184,180.2,181.85,182.1,182.04,3601269,6555.8894695,
RCOM,EQ,12-Jan-2010,182.1,182.1,182.85,175.05,175.3,175.45,179.06,4834928,8657.6031315,
RCOM,EQ,13-Jan-2010,175.45,174,176.6,173.05,175.7,175.55,175.01,3276310,5733.8242525,
RCOM,EQ,14-Jan-2010,175.55,177.2,184.2,175.65,182.85,183,180.8,7227593,13067.2365775,
RCOM,EQ,15-Jan-2010,183,183,193.4,183,191.3,191.6,191.03,15459863,29533.7056915,
RCOM,EQ,18-Jan-2010,191.6,189.9,193.8,188.35,190.05,190.45,191.27,4710277,9009.3851875,
RCOM,EQ,19-Jan-2010,190.45,190,192.9,185.2,186.5,186.35,188.67,4458474,8411.945425,
RCOM,EQ,20-Jan-2010,186.35,187,190.6,185.3,186.6,186.9,188.05,3581194,6734.2921825,
RCOM,EQ,21-Jan-2010,186.9,186.85,189.75,184.15,185.3,185.15,186.85,3673061,6863.2499155,
RCOM,EQ,22-Jan-2010,185.15,183.7,184.7,176.45,181.6,181.55,181.5,4194634,7613.198626,
Not Found
The requested object does not exist on this server. The link you
followed is either outdated, inaccurate, or the server has been
instructed not to let you have it.
Firefox 3.6
-Peter Ehlers
"Not Found
The requested object does not exist on this server. The link you
followed is either outdated, inaccurate, or the server has been
instructed not to let you have it. Please inform the site
administrator of the referring page."
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
______________________________________________