I am extracting a list of price of a stock (Open, High, Low, Close, Volume etc), from r (quantmod was used to bring in the data from external source) to excel, however the date column is omitted.
I thought the issue is in the fact that because the 'date' is not recognized as a variable, whereas other columns are (Open, High etc). I've tried to insert the dates via as.Date (from Sys.Date-365 to Sys.Date, as I only require a one year set of data), and cbind them. However because the length is different, and this is a vector based list, it won't fit (the data that comes from external source only shows in a working days, where as.Date will have full 365 days shown.
x <- getSymbols("SPY", src ="yahoo", from=Sys.Date()-365, to=Sys.Date(), auto.assign=FALSE )
write.csv(s, file = "test.csv")
Writing csv like above will result in the date column showing as 1, 2, 3, 4 ..., but i need the date that matches the price like it shows in the View mode in r.