[R] rpart error when constructing a classification tree

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed Jan 30 10:33:14 CET 2008



Randy Griffiths wrote:
> I am trying to make a decision tree using rpart. The function runs very
> quickly considering the size of the data (1742, 163). When I call the
> summary command I get this:
> 
>> summary(bookings.cart)
> Call:
> rpart(formula = totalRev ~ ., data = bookings, method = "class")
>   n=1741 (1 observation deleted due to missingness)
> 
>   CP nsplit rel error
> 1  0      0         1
> Error in yval[, 1] : incorrect number of dimensions
> 


And we get:

R> summary(bookings.cart)
Error in summary(bookings.cart) : object "bookings.cart" not found

hence we cannot reproduce and inspect your problem. Please read the 
posting guide.

Uwe Ligges


> note:
>> dim(bookings)
> [1] 1742  163
> 
> 
> I have run rpart on past projects without any problems. I have used a
> catagorical version of the variable totalRev that was partitioned into four
> levels (and coded as a factor).
> I tried making a tree with the tree command (in the 'tree' package) and was
> able to construct a tree without any errors. However, I would much rather
> use rpart.
> 
> Does anyone have any ideas that might help?
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list