I feel that I am possibly not understanding a table type. I'm pulling data using the package "quantmod" and function getSymbols("AAPL", src = "yahoo")
. The data shows up in my grid and is usable within R.
I'm trying to export via write.csv()
, but the dates are turned into ascending numbers (1,2,3,...). Is there a way to export the date as well when it is a record name?
This is what I'm using:
write.csv(AAPL, "C:/Users/Desktop/AAPL.csv", row.names = TRUE)
R shows:
Date - Price
CSV in excel shows:
1 - Price
Any help is much appreciated!
So when you import the data for AAPL it has dates in rownames thats why when you try to export it, it doesnt include the date. USE THIS
getSymbols("AAPL", src = "yahoo")
After importing use the code below and then export x:
x<-data.frame(AAPL)
x$date<-rownames(x)
rownames(x)<-NULL