简体   繁体   English

当我从 BiodiversityR package 运行 rankabundance 时,我收到以下错误代码

[英]I'm getting the following error code when I run rankabundance from BiodiversityR package

I'm trying to compute the ranked abundances of a community data (site*species matrix) by using rankabundance(df) in the BiodiversityR package.我正在尝试通过使用 BiodiversityR package 中的 rankabundance(df) 来计算社区数据(站点*物种矩阵)的排名丰度。 But the following error keeps popping up whenever I try to run it.但是每当我尝试运行它时,都会弹出以下错误。 Error in `[.data.frame`(pi, i): undefined columns selected

Can someone please help with what this code means?有人可以帮助了解这段代码的含义吗? I've already specified the column names when sub-setting the data.我已经在子设置数据时指定了列名。 And the data is also in the right format;并且数据的格式也正确; I've tried running BCI (from vegan) for the same function and it runs perfectly fine.我试过为相同的 function 运行 BCI(来自素食主义者),它运行得非常好。 My data is the same format as BCI.我的数据与 BCI 格式相同。

library(BiodiversityR)
rankabundance(alad2, digits = 1)

This is the code that I'm running, and the data-frame is arranged in a site*species matrix, where sites are rows and species are columns.这是我正在运行的代码,数据框排列在一个站点*物种矩阵中,其中站点是行,物种是列。

Here is the dataframe, alad2:这是 dataframe,alad2:

structure(list(`Alysicarpous sp.1` = c(0L, 0L, 1L, 0L, 0L, 4L, 
0L, 0L, 0L, 0L, 0L, 4L), `Alysicarpous sp.2` = c(0L, 0L, 1L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), `Bothriochloa pertusa` = c(0L, 
0L, 4L, 0L, 12L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), `Butea monosperma ` = c(0L, 
0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), `Chromolaena odorata` = c(0L, 
0L, 0L, 1L, 3L, 0L, 0L, 5L, 17L, 4L, 0L, 0L), `Chrysopogon sp.*` = c(62L, 
64L, 57L, 68L, 72L, 74L, 72L, 62L, 56L, 67L, 54L, 61L), `Desmodium triflorum` = c(0L, 
2L, 7L, 12L, 6L, 12L, 0L, 10L, 13L, 0L, 14L, 8L), `Eragrostis tenuifolia` = c(0L, 
0L, 0L, 0L, 0L, 0L, 0L, 2L, 0L, 0L, 0L, 0L), `Fimbristylis dichotoma` = c(32L, 
38L, 41L, 26L, 38L, 38L, 41L, 20L, 28L, 41L, 31L, 32L), H80 = c(2L, 0L, 0L, 0L, 0L, 0L, 2L, 0L, 0L, 0L, 0L, 0L), `Hemigraphis sp.*` = c(0L, 
0L, 0L, 0L, 0L, 0L, 3L, 0L, 0L, 3L, 0L, 0L), `Ischaemum sp.*` = c(18L, 
0L, 18L, 18L, 0L, 18L, 33L, 26L, 12L, 16L, 24L, 23L), `Lantana camara` = c(0L, 
0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L), `Leucas aspera` = c(0L, 
0L, 0L, 0L, 2L, 2L, 0L, 0L, 1L, 0L, 0L, 0L), `Oldenlandia umbellata` = c(3L, 
6L, 9L, 8L, 3L, 0L, 0L, 3L, 6L, 7L, 3L, 0L), `Phyllanthus virgatus` = c(0L, 2L, 9L, 13L, 6L, 7L, 9L, 0L, 0L, 6L, 11L, 8L), `Rungia pectinata` = c(0L, 
0L, 0L, 2L, 3L, 3L, 0L, 0L, 0L, 0L, 0L, 0L), `Senagalia pennata` = c(0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L), `Senna spectabilis ` = c(0L, 
0L, 0L, 0L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), `Setaria flavida` = c(0L, 
0L, 0L, 0L, 11L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), `Setaria pumila` = c(4L, 
0L, 13L, 0L, 0L, 0L, 5L, 4L, 7L, 5L, 4L, 7L), `Themeda triandra` = c(0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 3L, 0L, 0L, 0L)), row.names = c(NA, 
-12L), class = c("tbl_df", "tbl", "data.frame"))

You do not have a data frame, but a tibble.您没有数据框,而是 tibble。 Use alad2 <- as.data.frame(alad2) and your code will work.使用alad2 <- as.data.frame(alad2)你的代码就可以工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM