[R] RPART error

victor pontes victor_pontes at yahoo.com
Fri May 20 20:15:07 CEST 2011


Hi,

I have been working generating decision tree analyses on large numbers of 
simulation datasets using the RPART function.  With some datasets, RPART is 
returning an error of "Error in yval[, 1] : incorrect number of dimensions".  
There seem to be certain types of splits that cause it to break and return this 
message.  

I am able to isolate the record at which this error message will begin 
appearing.  For 

example, there is a difference of one record in the enclosed files; one file 
(noproblem.csv) will 

correctly produce output.  The second (problem.csv), with only one additional 
record, will 

return the error message and no output. 

I am running R 2.13.0 on a Windows XP platform.  

To reproduce the problem:

library(rpart)
data <- read.csv("problem.csv", header=T)control=rpart.control(minbucket=10)
x <- rpart(cad~v1+v2+v3+v4+v5+v6+v7+v8+v9+v10,data=data, method = "class", 
control=control)
summary(x)

Similar code run on "noproblem.csv" will not produce the error.

Any suggestions on how to proceed to debug this issue would be greatly 
appreciated.  I am a novice R user, but not a novice programmer (SAS, some C, 
Java).  


Thanks for your time.

Victor Pontes
Inatec, Inc.
Medford, MA


More information about the R-help mailing list