Date information disappears when save to CSV

csv, date, quantmod, r

Solution

as SPY is a xts/zoo object this will do the trick:

replace:

write.csv(SPY, "C:/SPY.csv")

with

write.zoo(SPY,"C:/SPY.csv",index.name="Date",sep=",")

Problem

I am trying to pull some data in from the internet and then export it to a CSV file, but I am loosing my date information in the CSV file. I can't figure out why. I'm new to R so please keep responses simple. Here is my code: ``` Library(quantmod) getSymbols("SPY", from = "2012-01-01", to = "2012-12-31") write.csv(SPY, "C:/SPY.csv") ```

Original source

Related problems