[Rd] bug in function rpart (PR#9245)

From: <yma_at_biostat.bsc.gwu.edu>
Date: Fri 22 Sep 2006 - 14:43:13 GMT

Full_Name: Yong Ma
Version: R 2.3.1
OS: Windows 2000
Submission from: (NULL) (

I have a data set containing 3000 observations. while I was trying to build a survival tree using the function rpart, I kept getting the following error message.
>tree<-rpart(coxph(Surv(diabv, diabf) ~ weight, data = sgotdat))
 Error in "$<-.data.frame"(`*tmp*`, "yval2", value = c(1, 638)) :

        replacement has 2 rows, data has 1 It was confusing to me because I was able to use the coxph function on the same data set with no problem at all. So I googled the internet and found some help from the following link.


It suggested that the problem has to do with the length of the data. So I tried a subset of my original data containing 2500 observations and BINGO it worked!

However, I need to run the analysis on the complete data set and the patch proposed by Andy is not clear to me how to implement. Please fix the bug systematically.

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Sep 23 00:51:58 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 22 Sep 2006 - 17:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.