[R] rpart error: "Error in dimnames(X)"
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Sep 26 19:19:39 CEST 2007
On Wed, 26 Sep 2007, Juned Siddique wrote:
> I'm using rpart to fit a tree using a large dataset: 7000 observations, 4651
> variables. All but one of the variables (age) are binary. When I run the
> code:
>
> fit1 <- rpart(lowergi ~ ., data=dset,method="class")
>
> I get the error:
>
>
> Error in dimnames(X) <-list(dn[1L]], unlist(collabs, use.names=FALSE)) :
> Length of `dimnames' [2] not equal to array extent
>
> I have no idea what this error means or what is causing the problem. I'm
> wondering if my dataset is too big, or if there is a problem with how the
> data are set up. Any help would be appreciated.
Well, we would appreciate help from you, so please read the footer to this
message. All I can tell you is that the error message did not come from
rpart, but most likely from as.matrix.data.frame (which does contain that
code line, unlike rpart)
The output of traceback() would have been helpful. The `Writing R
Extensions' manual shows you how to debug a problem like this.
My best guess is that at least one of those 4651 columns are not suitable
input to rpart.
>
> [[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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list