More complex time-series objects
The main limitation of the
ts
time-series R object class (besides the aforementioned x axis issue) is that it cannot deal with irregular time-series. To overcome this problem, we have several alternatives in R.
The zoo
package and its reverse dependent
xts
packages are ts
-compatible classes with tons of extremely useful methods. For a quick example, let's build a zoo
object from our data, and see how it's represented by the default plot:
> library(zoo) > zd <- zoo(daily[, -1, with = FALSE], daily[[1]]) > plot(zd)
As we have defined the date
column to act as the timestamp of the observations, it's not shown here. ...
Get Mastering Data Analysis with R now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.