[R] Problems with metaMDS from vegan

Spencer Graves spencer.graves at pdf.com
Sun Nov 12 22:26:07 CET 2006


      Three more suggestions: 

      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)?  If you 
include an example like that, it will increase your chances of getting 
an answer from the maintainer.  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.  Please include 'sessionInfo()' 
with your email, in case the problem happens to be related to something 
in your local operating environment. 

      2.  Have you tried 'traceback()' after your failed call to 
'metaMDS'?  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.  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.  For example, 
consider the following: 

      x <- X[sel, ]

      If "sel" only selects 1 row of "X" here, "x" will be a vector.  
This can be fixed by replacing it by the following: 

      x <- X[sel, , drop=FALSE]

      In this case, "x" is still a two-dimensional array, now with only 
one row.  If "sel" selects 0 rows, "x" will still be a two-dimensional 
array, now with 0 rows. 

      This may allow you to fix the code.  Then you can send the 
suggested fix to the vegan maintainer.  This person is doubtless very 
busy and may not have time to try to figure out why something doesn't 
work, especially when you provide nothing more than a vague claim that 
it doesn't work, as I indicated above. 

      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).  The 'debug' function makes it easy to walk through the code 
line by line, checking the contents of different variables, etc.,  until 
the problem is identified.  Before I try 'debug', I make a local copy of 
the problem function, which I study as I walk through the code.  I've 
done this many times with my own code and with the code of others.  I 
know of two cases where this will not work: 

            3.1.  If I find the problem line but don't understand the 
code enough to know what it means, I won't know how to fix it.  However, 
at least I can mention what I found to someone else:  This can make it 
easier for someone else to see how to get around the problem. 

           3.2.  The 'debug' function does not work with generic 
functions following the S 4 standard.  In my cursory review of the vegan 
package, I did not find anything suggested use of "S 4", so with luck, 
you won't need to deal with that. 

           NOTE:  I have not used the 'debug' package, but I understand 
it to be functionally unrelated to the 'debug' function, providing a 
much more flexible implementation of similar capabilities. 

      If you follow these three suggestions, there's a good chance you 
will find how to get around the problem.  If that fails, you will almost 
certainly have something that will make it much easier for someone else 
to isolate and fix the problem. 

      Hope this helps. 
      Spencer Graves

Peter Roosen wrote:
> Hello Spencer,
>
>   
>>       Have you sent this question to the vegan maintainer, identified, 
>> e.g., with help(package="vegan")?
>>     
>
> I wrote a mail directly to Jari prior to posting in this group. My 
> posting here was no sooner than waiting (in vain) for an answer for 
> about a week.
>
>   
>>  I've added that name as a "cc" to 
>> this email. 
>>
>>       Hope this helps. 
>>     
>
> We'll see! :) But thanks a lot anyhow for your help!
>
> 	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.
>



More information about the R-help mailing list