factor_add: Add predictor to the current model formula

View source: R/factor_add.R

factor_addR Documentation

Add predictor to the current model formula

Description

Adds the predictor to the list of predictors. These will be used in model formula when model_fit is called.

Usage

factor_add(setup, var_symbol)

Arguments

setup

Setup object. Created at the start of the workflow. Usually piped in from previous step.

var_symbol

Unquoted symbol. Predictor to be added. Must be present in the modeling dataset.

Value

Setup object with updated attributes.

Examples

require(dplyr) # for the pipe operator
data('sev_train')

setup <- setup(
  data_train = sev_train,
  target = 'sev',
  weight = 'numclaims',
  family = 'gamma',
  keep_cols = c('pol_nbr', 'exposure', 'premium')
)

print(setup)

# not fitted yet
modeling <- setup %>%
  factor_add(pol_yr) %>%
  factor_add(agecat)

print(modeling)



realgabon/insuRglm documentation built on Jan. 2, 2023, 2:51 a.m.