Sorry for asking what it seems a simple question, but maybe someone can help me.
I'm trying to use getSymbols with my own ticker list.
I have the ticker list imported previously from a .csv file with 55 tickers and seems correctly imported into my environment. But, how can I read the Tickers dataframe correctly when running the getSymbols? Currently I'm having a NULL error when I run the code below.
library(quantmod) Tickers <- read.csv("nasdaq_tickers_list.csv", stringsAsFactors = FALSE) getSymbols(Tickers,from="2018-01-01", src="yahoo" )
If I run class(Tickers) it is a data.frame.
What I'm doing wrong?
Any comment will be appreciated.
Thank you very much.
If you read the helpfile for
getSymbols by doing
?getSymbols, you'll see that the first argument needs to be "a character vector specifying the names of each symbol to be loaded". So do this:
VARNAME is the column name of the ticker column in your dataframe. Using the
$ to subset the dataframe will return the column (a character vector, presumably) rather than the whole dataframe, and will then be what