[R] Data Download Probelm from Yahoo

From: Sumanta Basak <sumantabasak_at_mail.com>
Date: Thu 31 Aug 2006 - 16:12:50 EST

Hi All,

I'm trying to download data using following code.

require(UsingR)                       ## This is the R-package you need
to run command yahoo.get.hist.quote

#Initialize empty table

closing <-NULL

#Downalod consituents since I don't have it on my comp
download.file("http://www2.standardandpoors.com/spf/csv/index/sp500.csv", "Z:/BETA PROJECT/DATA DOWNLOAD FROM YAHOO/Constituents.csv", "internal", quiet = FALSE, mode = "wb",cacheOK =
TRUE) constituents<-as.matrix(read.csv("Z:/BETA PROJECT/AUGUST/YEARLY WORK/MASTER Constituents.csv",header=T))

for (i in constituents[1:250,1])
s<-yahoo.get.hist.quote(instrument = sub("\\.","\\-",i), destfile = paste(i, ".csv", sep = ""), start="1996-01-01", end="2006-08-28", quote = c("Close"), adjusted = TRUE, download = TRUE, origin = "1970-01-01", compression = "d") closing <-cbind.ts(closing ,s)

## This will downlaod all data ##

write.csv(closing,"Z:/BETA PROJECT/AUGUST/YEARLY WORK/yahoooutput1_2000.csv")

But i'm getting the following error. Can anyone explian why?

trying URL 'http://chart.yahoo.com/table.csv?s=A             
&a=0&b=01&c=1996&d=7&e=28&f=2006&g=d&q=q&y=0&z=A              &x=.csv'
Error in download.file(url, destfile) : cannot open URL
&a=0&b=01&c=1996&d=7&e=28&f=2006&g=d&q=q&y=0&z=A              &x=.csv'
In addition: Warning message:
unable to connect to 'chart.yahoo.com' on port 80.

Thanks a lot in advance.

Sumanta Basak.

Play 100s of games for FREE! http://games.mail.com/

	[[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu Aug 31 17:19:41 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 31 Aug 2006 - 18:23:54 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.