物种NA丰富包装问题的富有人

时间:2020-04-01 20:35:27

标签: r na

我需要计算一个名为riquesa1的数据框的物种丰富度,该数据框由13个变量(物种)和59个观测值(每种物种在总样本中的频率)组成。 我正在使用带有以下代码的丰富包中的丰富功能:

rich(matrix = riquesa1, verbose = FALSE, nrandom = NULL)

但是,当我运行该函数时,出现此错误:

Error in if (S[is] == 0) next : missing value where TRUE/FALSE needed

我想可能是由于Na存在于数据框中,但我不确定。 我该怎么解决?

提前谢谢!

1 个答案:

答案 0 :(得分:0)

reconstruct <- structure(list(`Amphora lybica` = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), `Amphora spp.` = c(0.405, NA, 0.127, NA, NA), `Cocconeis placentula` = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), `Cyclotella ocellata` = c(NA, NA, NA, NA, 0.0606), `C. distinguenda complex` = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), `Diploneis ovalis` = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), `Encyonopsis subminuta` = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), `Encyonopsis caespitosa` = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), `Hantzschia amphioxus` = c(NA, 0.187, 0.08, NA, NA), `Luticula mutica` = c(NA, 0.283, 0.163, NA, NA), `Mastogloia smithii` = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), `Mastogloia spp.` = c(0.092, NA, NA, NA, NA), `Pseudostaurosira brevistriata` = c(0.428, 0.063, 0.331, 0.964, 0.798)), row.names = c(NA, -5L), class = c("tbl_df", "tbl", "data.frame"))