Learn R Programming

linea (version 0.1.1)

apply_transformation: #' 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
)

Value

data.frame of raw_data with added transformed variables

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

Examples

Run this code

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')

Run the code above in your browser using DataLab