diff_variables: Differences of Variables

View source: R/diff_variables.R

diff_variablesR Documentation

Differences of Variables

Description

Produces the first difference of variables in a time-series object or in a list of named time-series objects.

Usage

diff_variables(data, variables = NULL, multi = NULL)

Arguments

data

a named time-series object or a list of named time-series objects.

variables

a character vector of variables that should be differenced, if they appear in a time-series object. If NULL (default), all variables are differenced.

multi

optional. Numeric by which the differenced series should be multiplicated.

Value

A differenced time-series object or a list of differenced time-series objects.

Examples

# Load data
data("gvar2019")
country_data <- gvar2019$country_data

# Take first difference of the variables "y" and "Dp" across all
# elements of object "country_data" and multiply them by 100
country_data <- diff_variables(country_data, variables = c("y", "Dp"), multi = 100)


franzmohr/bgvars documentation built on Sept. 2, 2023, 12:45 p.m.