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
Have you sent this question to the vegan maintainer, identified, e.g., with help(package="vegan")? I've added that name as a "cc" to this email. Hope this helps. Spencer Graves Peter Roosen wrote:> 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 > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >
The problem is solved: With the help of the Vegan library maintainer the error was found immediately. It was a misinterpretation/overlooking of the provided documentation. The problem lies here:> > meta <- metaMDS(distab.dist, distance="bray", k, trymax=50)The provided primary data matrix - distab.dist - was in my case a distance matrix, not a original data set matrix as demanded in the documentation. As Jari Oksanen told me, several other users seem to have been trapped by the same pragmatic error also, which are reported in his newer versions of the Vegan library only. At least version 1.6-10 ran smoothly without reporting an error, thus leaving the user with the faulty notion of a correctly running program. It seems that the pragmatic error of not only me stemmed from the fact that the frequently used methods cmdscale and isoMDS from the original R distribution scope require indeed *distance matrices* as their first input value. So, switching from them to the Vegan metaMDS, makes one easily overlook the important change in required data structure. The error condition that the newer versions of Vegan now returns helps to detect this faulty data provision. Kind regards and many thanks to the list and the maintainer, Peter