rt_ts_create_lagged_dataset: returns a new dataset containing the lagged values for...

View source: R/times_series.R

rt_ts_create_lagged_datasetR Documentation

returns a new dataset containing the lagged values for specified variables

Description

returns a new dataset containing the lagged values for specified variables

Usage

rt_ts_create_lagged_dataset(
  dataset,
  num_lags = 1,
  lag_variables = NULL,
  keep_variables = NULL
)

Arguments

dataset

a time-series dataset (single- or multi-variable)

num_lags

the number of lags to include (e.g. '3' will include 3 lagged variables for each applicable variable, 'x_lag_1', 'x_lag_2', 'x_lag_3')

lag_variables

the variables (i.e. columns) to include lagged values for (the original column will be retained). A value of 'NULL' is used for single-variable datasets (i.e. ts datasets that have no columns) or, for multi-variable datasets, will create lagged variables for *all* variables in the dataset.

All variables that are not specified in 'lag_variables' are removed.

keep_variables

the variables to retain in the dataset which are not specified in 'lag_variables'. A value of 'NULL' is used for single-variable datasets.


shane-kercheval/rtools documentation built on July 7, 2022, 8:31 a.m.