sum_ts_objects: Sum two ts objects to get a single ts object

Description Usage Arguments Value Examples

View source: R/HELPER_sum_ts_objects.R

Description

sum_ts_objects is a function to sum two separate time series object to get a single ts object.

Usage

1
sum_ts_objects(ts_objects, new_grouping = "")

Arguments

ts_objects

A list of time series object to be summed.

new_grouping

A character vector containing the grouping of the newly created time series object.

Value

A summed time series object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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)
sum_ts_objects(
   ts_objects = list(
      ts_object,
      ts_object,
      ts_object
   ),
   new_grouping = "state = Trice New York   &   oil_company = Trice CompanyA"
)

ing-bank/tsforecast documentation built on Sept. 18, 2020, 9:40 a.m.