There seems to be a problem in the second.extinct function (or in the extinction function). When you run it with the "abundance" method on "lower", there are special cases for which only one column will be left in m2 (after i iterations in the repeat loop), which will cause problems in the extinction function (L40). Example:
Correct!
I adopted your proposal for the extinction function (rather than second.extinct).
I wonder why I so far didn't run into this problem!
Many thanks for reporting and fixing. I will commit the fix immediately.
Dear Carsten,
There seems to be a problem in the second.extinct function (or in the extinction function). When you run it with the "abundance" method on "lower", there are special cases for which only one column will be left in m2 (after i iterations in the repeat loop), which will cause problems in the extinction function (L40). Example:
web <- matrix(c(3, 2, 3, 0, 0, 0, 0, 1, 0, 0, 0, 1), ncol = 3) second.extinct(web, participant = "lower", method = "abundance")
From my understanding, the problem could be solved by changing line 39 in extinction to
web <- web[sample(1:nrow(web)), sample(1:ncol(web)), drop = FALSE]
or by changing line 38 in second.extinct to
Seems to yield the same result. Or do I miss something?
Best, Felix
https://github.com/biometry/bipartite/blob/f016fbd6a5d9d722273ed2878036b1445b2f346c/bipartite/R/extinction.R#L39