Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

one_of() as a valid selector #85

Closed
franperezlopez opened this issue Aug 15, 2017 · 1 comment

Comments

@franperezlopez
Copy link

commented Aug 15, 2017

could you please add this feature to your backlog? I think I'd be very helpful to select columns via their own names, and not using integer indexes (num_range())

thanks!! 馃檱

topepo added a commit that referenced this issue Aug 16, 2017
@topepo

This comment has been minimized.

Copy link
Collaborator

commented Aug 16, 2017

No problem!

> library(recipes)
Loading required package: dplyr

Attaching package:dplyrThe following objects are masked frompackage:stats:

    filter, lag

The following objects are masked frompackage:base:

    intersect, setdiff, setequal, union


Attaching package:recipesThe following object is masked frompackage:stats:

    step

> library(caret)
Loading required package: lattice
Loading required package: ggplot2
> 
> set.seed(654)
> dat <- twoClassSim(10)
> some_vars <- c("Nonlinear1", "Nonlinear2")
> 
> rec <- recipe(Class ~ ., data = dat) %>%
+   # step_center(num_range(prefix = "TwoFactor", range  = 1:2)) %>%
+   step_scale(one_of(some_vars)) %>%
+   prep %>%
+   print
step 1 scale training 
Data Recipe

Inputs:

      role #variables
   outcome          1
 predictor         15

Training data contained 10 data points and no missing data.

Steps:

Scaling for Nonlinear1, Nonlinear2 [trained]
> 

@topepo topepo closed this Aug 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can鈥檛 perform that action at this time.