Using quantmod and collecting data from Yahoo.
I am trying to get the dates that are in rownames.
However I am just getting NULL.
library("quantmod")
sp500 <- new.env()
getSymbols("^GSPC", env = sp500, src = "yahoo",
from = as.Date("2008-01-04"), to = Sys.Date())
GSPC <- get("GSPC", envir = sp500)
date1 <- rownames(GSPC)
date1
> NULL
I would be grateful for your help into getting the rowname dates into a vector.
You need to use the
indexfunction. Thextsobject isn’t the same as a normaldata.frame, and has its own way of handling dimension names.