/usr/lib/R/site-library/recipes/doc/Selecting_Variables.R is in r-cran-recipes 0.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## ----ex_setup, include=FALSE---------------------------------------------
knitr::opts_chunk$set(
message = FALSE,
digits = 3,
collapse = TRUE,
comment = "#>"
)
options(digits = 3)
## ----credit--------------------------------------------------------------
library(recipes)
data("credit_data")
str(credit_data)
rec <- recipe(Status ~ Seniority + Time + Age + Records, data = credit_data)
rec
## ----var_info_orig-------------------------------------------------------
summary(rec, original = TRUE)
## ----dummy_1-------------------------------------------------------------
dummied <- rec %>% step_dummy(all_nominal())
## ----dummy_2-------------------------------------------------------------
dummied <- rec %>% step_dummy(Records) # or
dummied <- rec %>% step_dummy(all_nominal(), - Status) # or
dummied <- rec %>% step_dummy(all_nominal(), - all_outcomes())
## ----dummy_3-------------------------------------------------------------
dummied <- prep(dummied, training = credit_data)
with_dummy <- bake(dummied, newdata = credit_data)
with_dummy
|