# rpart and rpart2

I'm not sure if this is more appropriate for SO or DS in Stack Exchange since technically it's not about coding: in caret package for training in R, it's possible to train the model using rpart or rpart2 as the method.

I understand that rpart is an implementation of CART. What is rpart2 and how is it different from rpart?

My eventual aim is actually to compare the difference between the tree generated by rpart and rpart2, because my result seems to imply rpart2 has better accuracy for my dataset, but I have no clue how to view the rpart2 tree.

Both rpart and rpart2 implement a CART and wrap the rpart function from the rpart library. The difference is the constraints on the model each enforces. rpart uses the complexity parameter, cp, while rpart2 uses the max tree depth, maxdepth.
See: train_model_list section of http://cran.r-project.org/web/packages/caret/caret.pdf and rpart.control section of http://cran.r-project.org/web/packages/rpart/rpart.pdf.
• Thanks. I belatedly found out also that the answer to the portion "but I have no clue how to view the rpart2 tree." is to view the finalModel element in the output of rpart2 trained with caret. – Ricky Jun 11 '15 at 7:21