Description Usage Arguments Value Examples
View source: R/HELPER_union_ts_objects.R
union_ts_objects
is a function to union two separate time series
object into a single ts object, which is comparable to a row bind.
1 | union_ts_objects(ts_object_1, ts_object_2)
|
ts_object_1 |
The first time series object to be unioned with the second. |
ts_object_2 |
The second time series object to be unioned with the first. |
A unioned time series object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ts_object <- tstools::initialize_ts_forecast_data(
data = dummy_gasprice,
date_col = "year_month",
col_of_interest = "gasprice",
group_cols = c("state", "oil_company"),
xreg_cols = c("spotprice", "gemprice")
) %>%
dplyr::filter(grouping == "state = New York & oil_company = CompanyA") %>%
tstools::transform_data_to_ts_object(seasonal_periods = 3)
ts_part_one <- ts_object %>%
trim_ts_object(
max_length = 179,
from_left = T
)
ts_part_two <- ts_object %>%
trim_ts_object(
max_length = 12,
from_left = F
)
ts_unioned <- union_ts_objects(
ts_object_1 = ts_part_one,
ts_object_2 = ts_part_two
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.