get_real: Create real terms series from columns in a dataframe given a...

Description Usage Arguments Value

View source: R/deflators.R

Description

Creates real terms series from a set of columns in a dataframe using the given row deflator series and the number of the row to use as the baseline. The deflator series must have the same length as the number of rows in the dataframe. If the deflator series is already in the dataframe, then pass it into the function with data$deflator_column. The deflator cannot contain NA or zero values. Use add_real to append the real terms series to the input dataframe.

Usage

1
get_real(data, deflator, from = 2, to = ncol(data), baserow = nrow(data))

Arguments

data

A dataframe containing columns of numerical data to be expressed in real terms.

deflator

The deflator series as numeric vector. The deflator series must be the same length as the data series and must not contain either NAs or zeros.

from

The number or name of the column from which real terms series are calculated. The default is 2, assuming one column for row labels. Use 1 if there are no preceding data columns.

to

The number or name of the column to which real terms series are calculated. The default is ncol(data), which means real terms series are calculated across all remaining columms in the dataframe.

baserow

The number of the row to be used as the baseline for calculating the real terms series. The default is the last row in the dataframe, which is assumed to be the most recent period.

Value

A tibble containing real terms series and any preceding columns.


olihawkins/cltools documentation built on Sept. 14, 2020, 7:25 a.m.