Description Usage Arguments Value Examples
View source: R/HELPER_add_missing_attributes_to_ts_object.R
add_missing_attributes_to_ts_object
is a function to add a set of
missing attributes to a time series object. This is usually required after
transforming a time series object, e.g. by applying the window
function, during which manually added attributes are removed.
1 | add_missing_attributes_to_ts_object(new_ts_object, prev_ts_object)
|
new_ts_object |
A time series object, to which the missing attributes need to be added. |
prev_ts_object |
A time series object, which contains the attributes that are missing. |
A time series object with an extended set of attributes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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)
new_ts_object <- window(
x = ts_object,
end = c(2001, 1)
)
attributes(new_ts_object)
new_ts_object <- add_missing_attributes_to_ts_object(
new_ts_object = new_ts_object,
prev_ts_object = ts_object
)
attributes(new_ts_object)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.