Rf model inputs
(outcome <- "age")
(vars <- c("shucked_wt", "length", "diameter", "viscera_wt", "shell_wt"))
(fmla <- paste(outcome, "~", paste(vars, collapse = " + ")))
#Abalone model rf
(abalone_model_rf <- ranger(fmla, data = abalone, num.trees = 500, respect.unordered.factors = "order", seed = set.seed))
Gus
October 26, 2022, 2:26pm
2
I think you missed one step. Your fmla variable is a string actually.
Try fmla <- as.formula(fmla)
FJCC
October 26, 2022, 2:27pm
3
I know nothing about the ranger() function but I notice that the call ends with seed = set.seed. Since there is a function named set.seed, I suggest you try seed = set.seed()
abalone_model_rf <- ranger(fmla, data = abalone, num.trees = 500,
respect.unordered.factors = "order", seed = set.seed())
Awesome. Thank you! The fmla tip worked.