Professional Documents
Culture Documents
zoo objects
M A N I P U L AT I N G T I M E S E R I E S D ATA W I T H X T S A N D Z O O I N R
Je rey Ryan
Creator of xts and quantmod
What is xts?
eXtensible Time Series
Matrix + Index
Observations + Times
[,1] [,2]
[1,] 1 3
[2,] 2 4
"2015-01-01" "2015-02-01"
[,1] [,2]
2015-01-01 1 3
2015-02-01 2 4
[,1] [,2]
2015-01-01 1 3
2015-02-01 2 4
index(x)
Je rey Ryan
Creator of xts and quantmod
Reality check
Data usually already exists, and needs wrangling
O en data isn’t in your preferred class
"xts" "zoo"
as.xts(read.table("file"))
as.xts(read.zoo("file"))
write.zoo(x, "file")
saveRDS(x, "file")