How to choose the method argument in rpart



I am currently studying about rpart in R and while studying I came across a argument name method which can take four values
I want to know how to decided which method to use .


It depends on what you want to achieve, but for comparing the means of 4 groups I would recommend ANOVA.

Not sure if get your point correctly.



y is a survival object, then method = “exp” is used.
y has 2 columns then method = “poisson” is used.
y is a factor then method = “class” is used.
for the remaining case “anova” is used.

Hope this helps!