# Example 1: Dataset with preformatted categorical variables
# In this case, internal options for variable types are not needed since categorical features
# are already formatted as factors.
library(MLwrap)
data(sim_data) # sim_data is a simulated dataset with psychological variables
wrap_object <- preprocessing(
df = sim_data,
formula = psych_well ~ depression + emot_intel + resilience + life_sat + gender,
task = "regression"
)
# Example 2: Dataset where neither the outcome nor the categorical features are formatted as factors
# and all categorical variables are specified to be formatted as factors
wrap_object <- preprocessing(
df = sim_data,
formula = psych_well_bin ~ gender + depression + age + life_sat,
task = "classification",
cat_vars = c("gender")
)
Run the code above in your browser using DataLab