[R] Dynamic file / url name with read.csv
B S
bs2167 at yahoo.com
Wed Jan 13 07:03:21 CET 2010
Hi-
I would like to be able to change the value of SymA below and download a file from the corresponding URL. Hardcoded, this line works fine:
Symbol<- read.csv("http://ichart.finance.yahoo.com/table.csv?s=SPY&ignore=.csv", stringsAsFactors=F)
However, when I incorporate using a variable for the ticker, it no longer works.
SymA<- "SPY"
Sym1<- cat('http://ichart.finance.yahoo.com/table.csv?s=",SymA,"&ignore=.csv",sep="";)
Symbol<- read.csv(Sym1, stringsAsFactors=F)
I know that the problem lies in the concatenation, but I've tried different variations of cat() and toString() (and others) with SymA and Sym1 but cannot seem to get a string together that will work. Would appreciate any suggestions for this simple problem??
Thank you.
More information about the R-help
mailing list