[R] function gdist, dist and vegdist in mvpart

Sina Muster sina.muster at web.de
Wed Mar 8 19:12:11 CET 2006

Dear R community,

I am analyzing plant communities with the function mvpart, using a 
dissimilarit matrix as input. The matrix is calculated with the funtion 

fit <- mvpart(gdist (ba12[,18:29], meth="maximum", full=TRUE, 
sq=F) ~ 			beers + slope_dem + elev_dem+ plc_dem + pr_curv+ 			 
+curv+max_depth+doc_rocks+ abandon+land_use+ca_old,
	data=ba12, xv="p")

This works fine. Now I would like to use other dissimilarity measures as 
can be found in the function dist (STATS) or vegdist (VEGAN).

De'Ath notes that gdist should be interchangeable with dist - but I 
receive following error message:

 > fit21 <- mvpart(dist (ba12[,18:29], meth="minkowski", diag=T, 
upper=T 		p=2) ~
	beers + slope_dem + elev_dem+ plc_dem + pr_curv+ 			 
curv+max_depth+doc_rocks+ abandon+land_use+ca_old,
	data=ba12, xv="p")
Error in model.frame(formula, rownames, variables, varnames, extras, 
extranames,  :
        Variable lengths differ

When computing the matrices directly...

ba12.dist1 <- gdist (ba12[,18:29], method="maximum", full=T, sq=F)
ba12.dist2 <- vegdist (ba12[,18:29], method="jaccard", diag=T, upper=T)
ba12.dist3 <- dist (ba12[,18:29], method="minkowski", p=1, diag=T, upper=T)

and looking at them, there appears to be no difference though only 
ba12.dist1 works with mvpart. With the other two I get the same error 
message as above.

What I am missing? Where is the problem?

Thanks for helping.

University of Potsdam, Germany
Department of Geoecology

More information about the R-help mailing list