why am not seeing other variables in decision tree

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?

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.