transactional_to_timeseries: transactional_to_timeseries functions

View source: R/transactional_to_timeseries.R

transactional_to_timeseriesR Documentation

transactional_to_timeseries functions

Description

Converts a transactional dataframe into a dataframe with time series objects, or a unique time series User can select the aggregation level, in terms of frequency, the transformed df can be If the transcational dataframe has skipped values due to non zero demand, the function fills this values with zeros

Usage

transactional_to_timeseries(
  df,
  index,
  orig_freq,
  aggregated_freq = NULL,
  return_all = TRUE,
  columns_to_return = NULL
)

Arguments

df

A transactional dataframe or matrix

index

The index (or the column with the timestamps) of the dataframe. It should be in a date format.

orig_freq

The original frequency of the dataframe.

aggregated_freq

The frequency of the transformed dataframe. NOTE 1: Default is set to null. With this setting it returns data at the original frequency NOTE 2: Accepts values in the form: 'month', 'week', '2 months' etc

return_all

A boolean variable indicating if all stored ids will be returned. NOTE 1: Default is set to TRUE. NOTE 2: If user passes in FALSE then variable columns_to_return will be considered

columns_to_return

A list with the names of the columns that will be included. NOTE 1: Default setting is NULL in accordance with return_all equal to TRUE. NOTE 2: If return_all is FALSE then columns_to_return can not be NULL

Value

A data frame with time series objects or a single time series

Author(s)

Filotas Theodosiou

Examples

dates <- c('2019-07-01', '2019-07-02', '2019-07-15', '2019-07-21')
AM <- c(90, 100, 50, 5 )
AC <- c(100, 100, 25, 4)
example_df <- data.frame(dates, AM, AC)
transactional_to_timeseries(example_df, index = 'dates', orig_freq = 'day')
transactional_to_timeseries(example_df, index = 'dates', orig_freq = 'day',
                                        aggregated_freq = 'week', return_all = FALSE,
                                        columns_to_return = c('AM'))




yForecasting/salesforecasting documentation built on April 29, 2022, 7:21 p.m.