vegandevs / vegan

R package for community ecologists: popular ordination methods, ecological null models & diversity analysis
https://vegandevs.github.io/vegan/
GNU General Public License v2.0
436 stars 95 forks source link

vegan release candidate breaks isopam #643

Closed jarioksa closed 1 month ago

jarioksa commented 1 month ago

vegan release candidate breaks isopam::isopam, and example(isopam) gives:

isopam>      ## load data to the current environment
isopam>      data(andechs)

isopam>      ## call isopam with the standard options
isopam>      ip <- isopam(andechs)
Partitioning level 1
Level 2: Partitioning 2 groups
..
Level 3: Partitioning 0 groups
Error in if (spl[j] == 1) { : missing value where TRUE/FALSE needed
Calls: example -> source -> withVisible -> eval -> eval -> isopam

Key information here is that it tries to partition 0 groups in which case spl[j] is NULL giving error in if().

I have bisected this to commit 6986d297617 which seems to be completely unrelated change in C function wcentre. The link to this commit seems to be isopam::isopamvegan::isomapvegan::wcmdscalevegan:::do_wcentre.

I have no idea what is happening here and how this could harm isopam::isopam, but currently this blocks vegan release. Neither vegan::isomap nor vegan::wcmdscale report any problems and behave quite normally, but the isomap::isomap fails in finding partitions. Neither I found any differences in outputs of these vegan functions between 2.6-4 and the release candidate.

jarioksa commented 1 month ago

isopam::isopam relied on row names in allocating observations to classes, but dimension names were lost in C code do_wcentre (and hence in vegan::wcmdscale and vegan::isomap). Therefore classifications vectors in isopam became NULL and isopam failed. The culprit was not the bisected commit, but the loss of dimension names only became apparent after the fix in that commit.