library(rpart)
 library(rpart.plot)
 test <- read.csv("https://raw.githubusercontent.com/kunal0895/RDatasets/master/Moody2018.csv")
 summary(test)
 boxplot(test$SCORE~test$GRADE)
 myprediction<-test
 decision <- rep('F',nrow(myprediction))
 decision[myprediction$SCORE>20] <- 'D'
 decision[myprediction$SCORE>30] <- 'C'
 decision[myprediction$SCORE>60] <- 'B'
 decision[myprediction$SCORE>70] <- 'A'
 myprediction$GRADE <-decision
 test$Projection <-decision
 error <- mean(test$GRADE!= myprediction$GRADE)
 error
 moody<-rpart(GRADE ~., data=test)
 Rpredict<-predict(moody,newdata=test,type="class" )
 error<-mean(Rpredict !=test$GRADE)
 error
 rpart.plot(moody)