library(rpart.plot)
library(rpart)
moody <- read.csv('https://raw.githubusercontent.com/kunal0895/RDatasets/master/Moody2018.csv')
# training and testing on the same dataset
rpart.tree <- rpart(GRADE ~ SCORE+ASKS_QUESTIONS+LEAVES_EARLY+ON_SMARTPHONE+LATE_IN_CLASS, control =
rpart.control(minsplit = 200), data = moody)
# Minimum number of observations that must exist in a node for a split to be attempted is 200.
rpart.plot(rpart.tree)