calculate_index: Transform series into index

View source: R/helpers.R

calculate_indexR Documentation

Transform series into index

Description

The index can be calculated in two ways:

  • from a series of values

  • from a series of mutations (from_growth_rate = TRUE)

Usage

calculate_index(periods, values, reference_period = NULL)

Arguments

periods

vector/variable with periods (numeric/string)

values

vector/variable with to be transformed values (numeric)

reference_period

period or group of periods that will be set to 100 (numeric/string)

Details

N.B. with from_growth_rate: The series of mutations must be equally long to the series of values. The vector should, therefore, also contain a mutation for the first period (this is likely 1). In the calculation, this first mutation is not used.

N.B. for the reference period: The first value is on default set to 100. An adjusted reference period can be provided in the paramater. The reference period can also be a part of a period. E.g. if the series contains months (2019jan, 2019feb), the reference period can be a year (2019).

Value

Index series

Author(s)

Farley Ishaak


cbsREPS documentation built on June 8, 2025, 9:38 p.m.