[R] Problems with metaMDS from vegan
Peter Roosen
roosen at vollmer-roosen.de
Fri Nov 10 08:01:03 CET 2006
Hello all,
I recently used the Vegan library quite extensively (in the context of
text similarity assessment) on an Ubuntu 6.06 LTS system with R version
2.2.1 (2005-12-20 r36812). The Vegan lib is version 1.6-10.
I hit on a problem yesterday, though, when trying to install R and Vegan
on two further computers - one Windows XP and one further Ubuntu 6.06
machine, taking either R version 2.4.0 on XP or 2.2.1 (as above) on
Ubuntu, and the newer Vegan version 1.8-3 on both machines. On the new
Ubuntu machine I even tried to regress to the Vegan 1.6-10, but to no
avail, as the error remains the same:
As soon as a I try to process an R matrix (see below) to obtain the MDS
I am confronted with:
> meta <- metaMDS(distab.dist, distance="bray", k, trymax=50)
Fehler in rowSums(x, na.rm = TRUE) : 'x' muss ein Array mit mindestens
zwei Dimensionen sein
Ausführung angehalten
(
translated:
error in rowSums(x, a.rm = TRUE) : 'x' must be an array of at least two
dimensions.
Execution stopped
)
This error is not appearing on identical data when using my older
installation. The only relevant googled mentioning of that error points
to a surplus (0,0) entry in the matrix to be processed, but this is
definitely not the case here. I crosschecked with *identical* data sets
on the mentioned systems.
Following are my (rather small) processing program and a (small cut of
a) matrix that produces the error, but runs smoothly on the older
version mentioned:
R batch script:
####
library(vegan)
simitab <- read.table("r.csv", header = TRUE, row.names = 1, sep = ";")
olimit <- max(simitab)
distab <- simitab / olimit
distab.dist <- vegdist(distab)
k <- 2
meta <- metaMDS(distab.dist, distance="bray", k, trymax=50)
postscript("metaMDS-CASE-DIMENd.ps", horizontal=TRUE)
plot(meta$points, col="blue", xlab="Dim 1", ylab="Dim 2",
main=sprintf("metaMDS für Variante = \"CASE\", dim = %d, Stress = %.2f
%%", k, meta$stress))
text(meta$points+xinch(0.09), labels=names(distab), cex=0.8)
###
Cut of data set:
###
US-1020525;US-1027783;US-1032733
US-1020525;1.00000000;0.00903941;0.93719674
US-1027783;0.00903941;1.00000000;0.01013081
US-1032733;0.93719674;0.01013081;1.00000000
###
(Remark: I did *not* test exactly the given small data set cut but took
the larger original one, being a 100*100 matrix + headers that I'd
rather not post in here.)
I'd appreciate any help in making the script functional again on our
newer installations!
Regards,
Peter
More information about the R-help
mailing list