我试图将dune数据集和dune.env数据集的一列传递给函数vegan::simper(),但始终显示错误消息。即使我运行直接从simper()帮助面板复制的代码,也会显示此错误消息,该帮助面板与下面所示的代码有所不同。
> library(vegan)
> data("dune"); data("dune.env")
> simper(dune,dune.env$Moisture)
Error in array(r, dim = d, dimnames = if (!(is.null(n1 <- names(x[[1L]])) & :
length of 'dimnames' [1] not equal to array extent我尝试将dune.env$Moisture转换为data.frame,以便更好地匹配其他纯素函数(如cca() )的输入要求,但继续接收相同的错误。
> (dune_moisture <- data.frame("dune_moisture" = dune.env$Moisture))
dune_moisture
1 1
2 1
3 2
4 2
5 1
6 1
7 1
8 5
9 4
10 2
11 1
12 4
13 5
14 5
15 5
16 5
17 2
18 1
19 5
20 5
> simper(dune,dune_moisture)
Error in array(r, dim = d, dimnames = if (!(is.null(n1 <- names(x[[1L]])) & :
length of 'dimnames' [1] not equal to array extent如何将数据传递给vegan::simper()
发布于 2022-10-19 15:50:32
类似的问题已经有报道,并在最近的纯素的CRAN版本(2.6-4)中得到修正。当代理包与纯素同时加载时,问题就出现了。proxy改变了标准R距离结构的处理方式,这会干扰simper内部的距离处理。这在https://github.com/vegandevs/vegan/issues/528中进行了讨论,并在最新的纯素版本(2.6-4)中得到了修正。如果您无法获得最新的纯素版本,请卸载代理,这样就可以了。
https://stackoverflow.com/questions/74117527
复制相似问题