ibrary(tidyverse)
library(forcats)
library(rpart)
library(rpart.plot)
glimpse(iris)
set.seed(123)
iris %>%
rpart(Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, data = ., method = "class", model = TRUE) %>%
rpart.plot(yesno = 2, type = 0)
I'm trying to make a classification tree using the iris dataset. However, in the output, I only see petal width and depth, not sepal width and sepal depth. How do I get all predictor variables in the plot?