View source: R/factor_modify.R
factor_modify | R Documentation |
Modifies one or more factors in the modeling dataset. Predictors in the model formula can also be modified directly.
factor_modify(setup, ...)
setup |
Setup object. Created at the start of the workflow. Usually piped in from previous step. |
... |
Expression. One or more named expressions (similar to dplyr::mutate). |
Setup object with updated attributes.
custom_factor
, variate
, as_simple_factor
,
offset
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') ) modeling <- setup %>% factor_add(pol_yr) %>% factor_add(agecat) %>% model_fit() %>% model_save('model1') %>% factor_modify(agecat = variate(agecat, type = 'non_prop', mapping = c(1, 2, 3, 4, 5, 6))) %>% model_fit()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.