3.2 tsibble objects

The tsibble package extends the tidyverse to temporal data and tsibble (or tbl_ts) objects are the way time-series data are stored in that package. There are many ways that you can transform a tsibble object into a matrix with each row being an observed time series.

library(tidyverse)
library(tsibble)
dat <- tourism %>% as_tibble %>% tidyr::spread(Quarter, Trips)
dat.matrix <- as.matrix(dat[, -1*(1:3)])