Collect time series as multiple time series.

ts_c(...)

Arguments

...

ts-boxable time series, objects of class ts, xts, data.frame, data.table, or tibble.

Value

a ts-boxable object of the same class as the input. If series of different classes are combined, the class of the first series is used (if possible).

Details

In data frame objects, multiple time series are stored in a long data frame. In ts and xts objects, time series are combined horizontally.

See also

ts_bind, to bind multiple time series to a single series.

Examples

head(ts_c(ts_df(EuStockMarkets), AirPassengers))
#> id time value #> 1 DAX 1991-07-01 03:18:27 1628.75 #> 2 DAX 1991-07-02 13:01:32 1613.63 #> 3 DAX 1991-07-03 22:44:38 1606.51 #> 4 DAX 1991-07-05 08:27:43 1621.04 #> 5 DAX 1991-07-06 18:10:48 1618.16 #> 6 DAX 1991-07-08 03:53:53 1610.61
# labeling x <- ts_c( `International Airline Passengers` = ts_xts(AirPassengers), `Deaths from Lung Diseases` = ldeaths ) head(x)
#> International Airline Passengers Deaths from Lung Diseases #> 1949-01-01 112 NA #> 1949-02-01 118 NA #> 1949-03-01 132 NA #> 1949-04-01 129 NA #> 1949-05-01 121 NA #> 1949-06-01 135 NA