Quantcast
Channel: Active questions tagged xts - Stack Overflow
Viewing all articles
Browse latest Browse all 57

How to round trip (to and from a .csv file) with an xts object?

$
0
0

Trying to do a round trip (write/read) with an xts object. read.zoo() returns a data frame! Converting this to an xts fails.

How do I make it an xts object?

library(quantmod)from <- "2016-01-01" ## leap yearto <- "2017-01-01"symbol <- "AAPL"getSymbols(symbol, from=from, to=to)class(AAPL)write.zoo(AAPL, file="newapple.txt", sep=",")x <- read.zoo("newapple.txt")class(x)x <- as.xts(x, RECLASS=TRUE) ## has errors# write.zoo(x, file="newerapple.txt", sep=",") ## crashes

Viewing all articles
Browse latest Browse all 57

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>