Recipe package error code

Hello all,

Attempting to utilize the recipe package to pre-process some data, below is the code.

rec_obj <- recipe(Churn.Value ~ ., data = train_tbl) %>%
  step_discretize(Tenure.Months, options = list(cuts = 6)) %>%
  step_log(all_nominal(), -all_outcomes()) %>%
  step_dummy(all_predictors(), -all_outcomes()) %>%
  step_center(all_predictors(), -all_outcomes()) %>%
  step_scale(all_predictors(), -all_outcomes()) %>%
  prep(data = train_tbl)

Receiving an error message that states: "Error: All columns selected for the step should be numeric"

From my understanding, the step_dummy function should encode categorical data into numerical data, which is why I'm confused about receiving this error.

Please correct me if I'm wrong, and thanks in advance.

For reference, here is the index page for the step_dummy function which should encode categorical -> numerical data

Without knowing how the data looks it can be hard to see what could be wrong.

Without knowing more about your data my feeling is that Tenure.Months is not numeric which is what step_discretize() needs.

If that doesn't solve your problem try to provide a minimal reprex (reproducible example). The goal of a reprex is to make it as easy as possible for me to recreate your problem so that I can fix it: please help me help you!

If you've never heard of a reprex before, start by reading "What is a reprex", and follow the advice further down that page.


Thanks for your advice going to try again tomorrow, shall give an update.

After double checking I actually needed step_log to call on a specific variable and changed step_dummy to call on all nominal. Somewhat working now, marking thread solved as it was my fault.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.