0

I want to normalize only an arbitrary selection of variables using step_normalize from the recipe package (tidymodels). Unfortunately I can't find a selection function that seems to work within the step_normalize which selects a list of variables:

library(tidymodels)
iris %>% 
  recipe(Species ~ .) %>% 
  step_normalize(vars_select(Sepal.Length, Petal.Length)) %>% 
  prep()

I get this error message:

Error: Not all functions are allowed in step function selectors (e.g. `vars_select`). See ?selections.
Ahorn
  • 3,686
  • 1
  • 10
  • 17
tover
  • 535
  • 4
  • 11

1 Answers1

2

step_normalize does not support this select helper function, this works:

iris %>% 
  recipe(Species ~ .) %>% 
  step_normalize(Sepal.Length, Petal.Length) %>% 
  prep()

See ?selections for supported selector functions.

Ahorn
  • 3,686
  • 1
  • 10
  • 17