3) Recalling a rpart() Decision Tree.

This Blog entry is from the Probability and Trees section in Learn R.

As with regression and most of the predictive analytics tools presented in this document, the predict() function can take the RegressionTree object in conjunction with a data frame,  then return the predictions.  To create predictions using the RegressionTree model and the FDX dataset:

RegressionTreePredictions <- predict(RegressionTree,FDX)
1.png

Run the line of script to console:

2.png
library(dplyr)
FDX <- mutate(FDX, RegressionTreePredictions)
3.png

Run the block of script to console:

4.png