knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
Functions for tidying time series objects. tidytime
can tidy ts
, xts
and zoo
objects. The zoo
tidier is identical to that available in the broom package, except that it returns a dplyr::tbl_df
.
All tidied time series have the following columns:
index
: time value from the messy data. Can be dbl
, date
or time
.series
: column with a descriptor for the type of messy data.value
: values from the original time series.> devtools::install_github('jayhesselberth/tidytime')
library(tidytime)
ts
) objectssample.ts <- ts(1:10, frequency = 4, start = c(1959, 2)) tidytime(sample.ts)
xts
objectslibrary(xts) data(sample_matrix) sample.xts <- as.xts(sample_matrix, descr='my new xts object') tidytime(sample.xts)
zoo
objectslibrary(zoo) x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1 x <- zoo(rnorm(5), x.Date) tidytime(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.