Hi
I have a vector (TICKERS) with stock symbols in it:
'> > head(TICKERS)
[1] "AAPL" "BAC" "AMZN" "T" "GOOG" "MO" '
I have a loop:
'for (i in 1:length(TICKERS)){
DATA <- try(getSymbols(TICKERS[i], adjust=T, auto.assign = F, src = 'yahoo'))
DATA <- data.frame(date=index(DATA), coredata(DATA))
DATA <- DATA[,7]
.....'
When run this loop, the following error is returned:
'Warning: AGN download failed; trying again.
Error in getSymbols.yahoo(Symbols = "AGN", env = , verbose = FALSE, :
Unable to import “AGN”.
argument "conn" is missing, with no default'
then the loop stops.
For some reason, the data for "AGN" cannot be downloaded which is not the issue. The issue is that the loop stops after this.
How can I make the loop continuing its execution after this error ( and possibly others) has been returned?
Thank you.
I found that the try function should do the job but it doesn't...