[R] Problems with metaMDS from vegan

Peter Roosen roosen at vollmer-roosen.de
Mon Nov 13 10:16:28 CET 2006


Hello Spencer,

>       1.  Have you tried to develop an example so small and simple that 
> it can be provided with a few lines of code in an email like this (as 
> suggested in the trailer to every email distributed by r-help)?

I did, but due to the simplicity of the example in my former posting you 
may have overlooked it.

> You should not criticize the maintainer 
> for not replying to your earlier email:  I did not see in your email any 
> information that would allow anyone to solve your problem unless s/he 
> just happened to be unbelievably lucky.

Well, the mentioning of my post to the maintainer was not intended as 
criticism, but as justification for the public posting itself.

> Please include 'sessionInfo()'

This does not reveal any additional information compared to that given 
in my former post, but anyhow (I noticed a new version of Vegan on 
Jari's HP and updated accordingly in the hope that it might cure the 
effect - which it didn't):


On the machine where the IDENTICAL CODE AND DATA is defunct:

 > sessionInfo()
R version 2.2.1, 2005-12-20, i486-pc-linux-gnu

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"
[7] "base"

other attached packages:
     MASS    vegan
"7.2-24"  "1.9-3"


On the machine where the code and data runs smoothly:

 > sessionInfo()
R version 2.2.1, 2005-12-20, i486-pc-linux-gnu

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"
[7] "base"

other attached packages:
     MASS    vegan
"7.2-24" "1.6-10"


(The third machine [Win XP with R 2.4.0 and Vegan 1.8.3-x], show the 
defunct symptoms, is not available for testing right now)


>       2.  Have you tried 'traceback()' after your failed call to 
> 'metaMDS'?

traceback() on the defunct installation yields:

 > traceback()
6: stop("'x' must be an array of at least two dimensions")
5: rowSums(x, na.rm = TRUE)
4: any(rowSums(x, na.rm = TRUE) == 0)
3: vegdist(comm, method = distance, ...)
2: metaMDSdist(comm, distance = distance, autotransform = autotransform,
        noshare = noshare, trace = trace, commname = commname, ...)
1: metaMDS(distab.dist, distance = "bray", k, trymax = 50)


> With luck, this will identify the function actually 
> generating the error.  Then you can list that function and try "find" 
> "rowSums(x, a.rm = TRUE)".  Then hunt for "x" in that code.

That rowSums() code is identical on both installations, but the higher 
layers of invocation differ in differing amounts. I checked with mgdiff.

> The 
> function that includes this call to 'rowSums' expects 'x' to be an array 
> of at least two dimensions.  Either you pass it something that does NOT 
> meet that description or someplace "x" might be created from selecting 
> rows or columns of a larger array and either 0 or 1 rows were selected, 
> thereby reducing the dimension of the array to 0 or 1.

Yes, I guessed such a dependency already, but do not see the exact place 
where to dig into. The major code differences are in the vegdist() and 
the metaMDSdist() functions but I cannot point my finger to a certain 
code part where I estimate it to break - sorry!

>       3.  If "1" and "2" fail to provide enlightenment, I would then try 
> the 'debug' functions (provided it was important enough for me to do so, 
> of course). ...

This is my next step to try as the first two do not seem to yield 
further insights for me, but I just wanted to return a timely reply to 
the other points you mentioned in your post and with a certain hope that 
it might give some longer term R users some ideas to communicate some ideas.

Thanks for your involvement,

	Peter



More information about the R-help mailing list