apply_transformation: #' apply_transformation

View source: R/model_run.R

apply_transformationR Documentation

#' apply_transformation

Description

Transform data based on model table

Usage

apply_transformation(
  raw_data = NULL,
  model_table = NULL,
  trans_df = NULL,
  pool_var = NULL,
  verbose = FALSE
)

Arguments

raw_data

data.frame containing data for analysis

model_table

data.frame as created in the build_model_table function

trans_df

data.frame defining the non-linear transformations to apply

pool_var

string specifying the pool variable name (e.g. 'country')

verbose

A boolean to specify whether to print warnings

Details

Transform data based on the model table by applying the transformation functions (e.g. decay, diminish, lag, and ma) with the specified parameters to the respective variable

Value

data.frame of raw_data with added transformed variables

Examples


pooled_data = read_xcsv(
 verbose = FALSE,
 file = "https://raw.githubusercontent.com/paladinic/data/main/pooled%20data.csv")


model_table = build_model_table('christmas')
model_table['decay'] = '0.5'

trans_data = apply_transformation(
 raw_data = pooled_data,
 model_table = model_table,
 pool_var = 'country')


linea documentation built on Sept. 15, 2022, 9:06 a.m.