ts_growth_rate_augment: Augment Data with Time Series Growth Rates

View source: R/augment-ts-growth.R

ts_growth_rate_augmentR Documentation

Augment Data with Time Series Growth Rates

Description

This function is used to augment a data frame or tibble with time series growth rates of selected columns. You can provide a data frame or tibble as the first argument, the column(s) for which you want to calculate the growth rates using the .value parameter, and optionally specify custom names for the new columns using the .names parameter.

Usage

ts_growth_rate_augment(.data, .value, .names = "auto")

Arguments

.data

A data frame or tibble containing the data to be augmented.

.value

A quosure specifying the column(s) for which you want to calculate growth rates.

.names

Optional. A character vector specifying the names of the new columns to be created. Use "auto" for automatic naming.

Value

A tibble that includes the original data and additional columns representing the growth rates of the selected columns. The column names are either automatically generated or as specified in the .names parameter.

Author(s)

Steven P. Sanderson II, MPH

See Also

Other Augment Function: ts_acceleration_augment(), ts_velocity_augment()

Examples

data <- data.frame(
  Year = 1:5,
  Income = c(100, 120, 150, 180, 200),
  Expenses = c(50, 60, 75, 90, 100)
)
ts_growth_rate_augment(data, .value = c(Income, Expenses))


spsanderson/healthyR.ts documentation built on Jan. 19, 2024, 10:02 p.m.