install.packages("rpart")
install.packages("caret")
install.packages("e1071")
library(rpart)
library(caret)
library(e1071)

model_decision_tree = train(INCOME ~ ., data = TrainSet, method = "rpart")

model_decision_tree_prediction = predict(model_decision_tree, data = TrainSet)

table(model_decision_tree_prediction, TrainSet$INCOME)

mean(model_decision_tree_prediction == TrainSet$INCOME)

#[1] 0.7341071