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
'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'
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]]

