[R] xerror and xstd are missing from cptable of the Rpart package

Kim C. minorthreatx at hotmail.com
Tue Feb 3 14:09:21 CET 2015


Hello all, 
I'm making a decision tree with the rpart package. I want to prune the tree and in many tutorials it says to use cptable. Like so: opt <- which.min(model_rpart$cptable[, "xerror"])
The problem is that when I look up model_rpart$cptable it only show the columns CP, nsplit, rel error. So xerror and xstd are missing. How can this be? 
Model looks like this: model <- rpart(Product~. , data=trainData, control=rpart.control(minsplit=50, cp=0.002, xval=0))

Thank you. 
Kim  		 	   		  
	[[alternative HTML version deleted]]



More information about the R-help mailing list