Closed TuomasBorman closed 6 months ago
Confirmed. This seems to hit all cases where distance function needs extra parameters. For instance, dbrda(varespec ~ Al + P + K, data=varechem, distance="bray", binary = TRUE)
also ignores binary argument. You suggested the obvious fix, but we need to check that it doesn't break anything else.
As a first fix, you can calculate the distances before dbrda
:
d <- vegdist(varespec, "aitchison", pseudocount = 1)
dbrda(d ~ N + P + K + Condition(Al), varechem)
This is now fixed. The same problem also appeared in capscale
and bioenv
, but adonis2
and metaMDS
were OK.
There could be a problem with mrpp
, but it refuses all extra arguments (no dots in function call) and there you need to use dissimilarities as input if you need extra arguments. I won't change this.
There may also be a problem with avgdist
, but it does not accept non-integer data. However, other arguments may be useful, and I will still see this.
Cool, thanks!
https://github.com/vegandevs/vegan/blob/a88584bf096e52ce9c291d0640bd4e4f9b8b364d/R/dbrda.R#L35
Hi,
it seems that
pseudocount
is not passed through fromdbrda
function. When aitchison distance is calculated, clr transform is applied. But sincepseudocount
is not going through, it leads to an error if there are non-positive values.I believe replacing line
X <- dfun(X, distance)
with
X <- dfun(X, distance, ...)
should work but in this case, but I am not sure if it breaks something else.
-Tuomas