An error occurred while trying to analyze the random forest model.
Could somebody help me?
There is an error message at the bottom.
library(palmerpenguins)
penguins
penguins %>%
filter(!is.na(sex)) %>%
ggplot(aes(flipper_length_mm, bill_length_mm, color = sex, size = body_mass_g)) +
geom_point(alpha = 0.5) +
facet_wrap(~species)
penguins_df <- penguins %>%
filter(!is.na(sex)) %>%
select(-year, -island)
library(tidymodels)
set.seed(123)
penguin_split <- initial_split(penguins_df, strata = sex)
penguin_train <- training(penguin_split)
penguin_test <- testing(penguin_split)
set.seed(123)
penguin_boot <- bootstraps(penguin_train)
penguin_boot
rf_spec <- rand_forest() %>%
set_mode("classification") %>%
set_engine("ranger")
rf_spec
penguin_wf <- workflow() %>%
add_formula(sex ~ .)
rf_rs <- penguin_wf %>%
add_model(rf_spec) %>%
fit_resamples(
resamples = penguin_boot,
control = control_resamples(save_pred = TRUE))
#error message
x Bootstrap01: preprocessor 1/1, model 1/1: Error in rangerCpp(treetype, x, y.m...