The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The R ecosystem knows a vast number of time series standards. Instead of creating the ultimate 15th time series class, tsbox provides a set of tools that are agnostic towards the existing standards. The tools also allow you to handle time series as plain data frames, thus making it easy to deal with time series in a dplyr or data.table workflow.
See tsbox.help for the full documentation of the package.
To install the stable version from CRAN:
install.packages("tsbox")
To install the development version:
# install.packages("remotes")
::install_github("ropensci/tsbox")
remotesinstall.packages("ropensci/tsbox", repos = "https://ropensci.r-universe.dev")
tsbox is built around a set of converters, which convert time series stored as ts, xts, data.frame, data.table, tibble, zoo, zooreg, tsibble, tibbletime, timeSeries, irts or tis to each other:
library(tsbox)
<- ts_c(fdeaths, mdeaths)
x.ts <- ts_xts(x.ts)
x.xts <- ts_df(x.xts)
x.df <- ts_dt(x.df)
x.dt <- ts_tbl(x.dt)
x.tbl <- ts_zoo(x.tbl)
x.zoo <- ts_zoo(x.zoo)
x.zooreg <- ts_tsibble(x.zooreg)
x.tsibble <- ts_tibbletime(x.tsibble)
x.tibbletime <- ts_timeSeries(x.tibbletime)
x.timeSeries <- ts_irts(x.tibbletime)
x.irts <- ts_tis(x.irts)
x.tis all.equal(ts_ts(x.tis), x.ts)
#> [1] TRUE
Because this works reliably, it is easy to write functions that work for all classes. So whether we want to smooth, scale, differentiate, chain, forecast, regularize or seasonally adjust a time series, we can use the same commands to whatever time series class at hand:
ts_trend(x.ts)
ts_pc(x.xts)
ts_pcy(x.df)
ts_lag(x.dt)
A set of helper functions makes it easy to combine or align multiple time series of all classes:
# collect time series as multiple time series
ts_c(ts_dt(EuStockMarkets), AirPassengers)
ts_c(EuStockMarkets, mdeaths)
# combine time series to a new, single time series
ts_bind(ts_dt(mdeaths), AirPassengers)
ts_bind(ts_xts(AirPassengers), ts_tbl(mdeaths))
Plotting all kinds of classes and frequencies is as simple as it should be. And we finally get a legend!
ts_plot(ts_scale(ts_c(mdeaths, austres, AirPassengers, DAX = EuStockMarkets[ ,'DAX'])))
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.