Description Usage Arguments Value Examples
View source: R/HELPER_trim_ts_object.R
trim_ts_object
is a function to trim a time series object, either from
the left (beginning) or from the right (end).
1 | trim_ts_object(ts_object, max_length = Inf, from_left = T)
|
ts_object |
Time series object to be trimmed. |
max_length |
A positive integer value indicating the maximum length the resulting ts object should be. |
from_left |
Boolean on whether to trim from the left/beginning (from_left = T) or right/end (from_left = F) of the time series object. |
A trimmed time series object.
1 2 3 4 5 6 7 8 9 10 11 | 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()
trim_ts_object(ts_object = ts_object, max_length = 42, from_left = F)
trim_ts_object(ts_object = ts_object, max_length = 42, from_left = T)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.