Search code examples
rquantmod

Exporting data from R to spreadsheet


I am trying to export stock prices from R to a spreadsheet. Everything is exporting OK except for the date. These are the commands I am using.

Edit: Just to confirm the date is not been exported at all.

library(quantmod)
library(dataframes2xls)
getSymbols("GOOG", from = "2010-01-01", to = "2012-06-30")
write.xls(GOOG, "C:/goog.xls")

Solution

  • You just need to include row.names=TRUE in your write.xls call

    write.xls(GOOG, "C:/goog.xls", row.names=TRUE)