I'm new to R and I am trying to store my tickers in a CSV file, having my codes read from the CSV and run through some codes,My CSV has only 3 lines:
Ticker
YHOO
IBM
below is my code.
Stocks <- read.csv(file.choose(),head=T) # tried to put in sep="," no luck
#loop through the tickers
for (i in Stocks){
getSymbols(i)
# do something here
}
then i get this error Error in do.call(paste("getSymbols.", symbol.source, sep = ""), list(Symbols = current.symbols, : could not find function "getSymbols.1"
I try to debug, so i do
for (i in Stocks) {print (i)}
[1] YHOO IBM
Levels: IBM YHOO
this is what i get. i think when i am trying to run the loop the code is taking YHOO IBM as 1 ticker rather than loading 1 ticker at a time. Can someone advise what is the proper way of reading from a CSV file and loop through the ticker? appreciate the advise!