# NOT RUN {
d_train <- pima_diabetes[1:700, ]
d_test <- pima_diabetes[701:768, ]
# Prep data. Ignore patient_id (identifier) and treat diabetes as outcome
d_train_prepped <- prep_data(d = d_train, patient_id, outcome = diabetes)
# Prep test data by reapplying the same transformations as to training data
d_test_prepped <- prep_data(d_test, recipe = d_train_prepped)
# View the transformations applied and the prepped data
d_test_prepped
# Customize preparations:
prep_data(d = d_train, patient_id, outcome = diabetes,
impute = list(numeric_method = "bagimpute",
nominal_method = "bagimpute"),
collapse_rare_factors = FALSE, convert_dates = "year",
center = TRUE, scale = TRUE, make_dummies = FALSE,
remove_near_zero_variance = .02)
# }
Run the code above in your browser using DataLab