[R] Error in mvpart example

Wearn, Oliver oliver.wearn08 at imperial.ac.uk
Fri Feb 26 14:55:29 CET 2010


Dear all,

I'm getting an error in one of the stock examples in the 'mvpart' package. I tried:

require(mvpart)
data(spider)
fit3 <- rpart(gdist(spider[,1:12],meth="bray",full=TRUE,sq=TRUE)~water+twigs+reft+herbs+moss+sand,spider,method="dist") #directly from ?rpart
summary(fit3)

...which returned the following:

Error in apply(formatg(yval, digits - 3), 1, paste, collapse = ",", sep = "") : 
  dim(X) must have a positive length

This seems to be a problem with the cross-validation, since the "xerror" and "xstd" columns are missing from the summary table as well.

Using the mpart() wrapper results in the same error:

fit4<-mvpart(gdist(spider[,1:12],meth="bray",full=TRUE,sq=TRUE)~water+twigs+reft+herbs+moss+sand,spider,method="dist")
summary(fit4)

Note, changing the 'method' argument to ="mrt" seems, superficially, to solve the problem. However, when the dependent variable is a dissimilarity matrix, shouldn't method="dist" be used (as per the examples)?

Thanks, in advance, for any help on this error.

Oliver


More information about the R-help mailing list