# NOT RUN {
data("credit_data")
## missing data per column
vapply(credit_data, function(x) mean(is.na(x)), c(num = 0))
set.seed(342)
in_training <- sample(1:nrow(credit_data), 2000)
credit_tr <- credit_data[ in_training, ]
credit_te <- credit_data[-in_training, ]
missing_examples <- c(14, 394, 565)
rec <- recipe(Price ~ ., data = credit_tr)
impute_rec <- rec %>%
step_modeimpute(Status, Home, Marital)
imp_models <- prep(impute_rec, training = credit_tr)
imputed_te <- bake(imp_models, new_data = credit_te, everything())
table(credit_te$Home, imputed_te$Home, useNA = "always")
tidy(impute_rec, number = 1)
tidy(imp_models, number = 1)
# }
Run the code above in your browser using DataLab