【问题标题】:Issues with generating ggiNEXT graph生成 ggiNEXT 图的问题
【发布时间】:2020-08-10 17:28:16
【问题描述】:

在解决my previous issue 之后,我来到了下一个问题。

这一次我认为它涉及解释结果,并且是收集数据的问题。

这是我采取的步骤:

#load packages

library(iNEXT)

#data here
ct <-structure(list(Station = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 
3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("CT01", 
"CT02", "CT03"), class = "factor"), Date = structure(c(10L, 11L, 
12L, 12L, 13L, 14L, 16L, 16L, 17L, 17L, 1L, 1L, 15L, 15L, 15L, 
15L, 15L, 18L, 19L, 2L), .Label = c("1/11/19", "13/11/19", "14/11/19", 
"15/11/19", "17/11/19", "18/11/19", "22/11/19", "23/11/19", "25/10/19", 
"26/10/19", "27/10/10", "27/10/19", "28/10/19", "29/10/19", "3/11/19", 
"30/10/19", "31/10/19", "6/11/19", "7/11/19"), class = "factor"), 
    Time = structure(c(23L, 22L, 25L, 28L, 24L, 15L, 31L, 20L, 
    18L, 19L, 2L, 8L, 3L, 7L, 6L, 16L, 17L, 21L, 9L, 14L), .Label = c("0:34:24", 
    "0:43:46", "13:07:10", "16:49:34", "17:26:28", "19:06:56", 
    "19:11:56", "19:13:28", "19:34:58", "19:53:00", "19:56:42", 
    "2:33:36", "2:34:40", "20:21:42", "20:27:00", "20:31:42", 
    "20:32:08", "22:25:22", "23:19:00", "23:50:24", "23:50:44", 
    "3:19:00", "4:26:00", "4:28:00", "4:46:00", "4:56:04", "5:13:32", 
    "5:18:00", "5:19:00", "5:56:00", "6:31:00"), class = "factor"), 
    DateTimeOriginal = structure(c(18L, 18L, 18L, 18L, 19L, 20L, 
    20L, 17L, 22L, 23L, 1L, 2L, 11L, 13L, 12L, 14L, 15L, 24L, 
    25L, 3L), .Label = c("1/11/19 0:43", "1/11/19 19:13", "13/11/19 20:21", 
    "14/11/19 17:26", "15/11/19 19:56", "17/11/19 0:34", "18/11/19 4:56", 
    "22/11/19 5:13", "23/11/19 2:33", "23/11/19 2:34", "3/11/19 13:07", 
    "3/11/19 19:06", "3/11/19 19:11", "3/11/19 20:31", "3/11/19 20:32", 
    "30/10/19 23:22", "30/10/19 23:50", "30/10/19 23:58", "30/10/19 23:59", 
    "31/10/19 0:00", "31/10/19 16:49", "31/10/19 22:25", "31/10/19 23:19", 
    "6/11/19 23:50", "7/11/19 19:34"), class = "factor"), Scientific_name_1 = structure(c(2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L), .Label = c("Callosciurus_notatus", "Rattus_tiomanicus"
    ), class = "factor"), Abundance_1 = c(2L, 1L, 4L, 3L, 4L, 
    3L, 1L, 2L, 1L, 3L, 2L, 2L, 2L, 3L, 2L, 3L, 3L, 1L, 1L, 4L
    )), row.names = c(NA, 20L), class = "data.frame")


ct$trapnights <- paste(ct$Station, ct$Date, sep="_") 

#create contingency table
ct.matrix <- xtabs(Abundance_1~Scientific_name_1+trapnights, data=ct)


#create species incidence matrix
ct.df1 <- ifelse(ct.matrix>0,1,0) 

#convert matrix > list
ct.df2<- list(ct.df1)

#run iNEXT
(ct.inext <- iNEXT(ct.df2, datatype="incidence_raw"))

# plot graph 
ggiNEXT(ct.inext, type=3)

此时,我收到此错误

Error in data.frame(do.call("rbind", z), site = rep(names(z), sapply(z,  : 
  arguments imply differing number of rows: 40, 0

我想知道它是否与我的实际数据有关(也许是因为我只有一个组合?我检查了 ct.inext,它给了我 1 的样本覆盖率(见下文:100% 样本覆盖率——是这甚至可能吗?)

> ct.inext

Compare 1 assemblages with Hill number order q = .
$class: iNEXT

$DataInfo: basic data information
    site  T  U S.obs SC Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10
1 site.1 14 15     2  1  1  0  0  0  0  0  0  0  0   0

$iNextEst: diversity estimates with rarefied and extrapolated samples.
[[1]]
    t       method order    qD qD.LCL qD.UCL    SC SC.LCL SC.UCL
1   1 interpolated     0 1.071  0.922  1.221 0.933  0.828  1.000
2   1 interpolated     0 1.071  0.922  1.221 0.933  0.828  1.000
10  7 interpolated     0 1.500  0.839  2.161 0.933  0.878  0.989
11  7 interpolated     0 1.500  0.839  2.161 0.933  0.878  0.989
20 14     observed     0 2.000  1.111  2.889 1.000  1.000  1.000
30 21 extrapolated     0 2.000  1.111  2.889 1.000  1.000  1.000
31 21 extrapolated     0 2.000  1.111  2.889 1.000  1.000  1.000
40 28 extrapolated     0 2.000  1.111  2.889 1.000  1.000  1.000

同样,任何帮助都会很棒!

【问题讨论】:

    标签: r inext


    【解决方案1】:

    只是一个微调。该错误是因为 ct.inext$iNextEst 未命名。我刚刚为 ct.inext$iNextEst 分配了一个随机名称,它给出了情节。

    ct$trapnights <- paste(ct$Station, ct$Date, sep="_") 
    ct.matrix <- xtabs(Abundance_1~Scientific_name_1+trapnights, data=ct)
    ct.df1 <- ifelse(ct.matrix>0,1,0) 
    ct.df2<- list(ct.df1)
    (ct.inext <- iNEXT(ct.df2, datatype="incidence_raw"))
    
    names(ct.inext$iNextEst) <- "Abundance"
    
    ggiNEXT(ct.inext, type=3, facet.var="none")
    

    ggiNEXT(ct.inext, type=2, facet.var="none")
    

    我不确定这是否是您期望的答案。我只是指出了为什么没有为您的代码生成绘图的原因。

    附注: 因为,我不熟悉这种分析,所以我不明白你为什么要将 Abundance 值转换为二进制,而我看过的示例不是二进制的。

    【讨论】:

    • 感谢您的帮助!一问:你怎么知道是匿名的问题?此外,根据文档中的示例,不需要命名:data(ciliates)。你知道为什么会有差异吗?
    • 回答您的问题,创建列表时出错,Callosciurus_notatus 和 Rattus_tiomanicus 都添加到列表的单个组件中。现在,我已经使用基于 Callosciurus_notatus 和 Rattus_tiomanicus 创建列表的正确方法更新了我的答案。我相信这就是您正在寻找的。​​span>
    • 我是如何找到丢失的名字的?在 do.call("rbind", z), z 中除了 ct.inext$iNextEst 什么都没有,我尝试使用 ct.inext$iNextEst 而不是 z 来运行这个 do.call,这有助于我找到问题所在。无论如何,这是由于创建列表的方式错误。
    • 重新回答您问题的第二部分。二进制是因为我们正在生成一个物种关联矩阵(每个采样点存在/不存在物种)。在 iNEXT 文档中有几个不同数据类型的不同示例——纤毛虫是我正在关注的。因此,$iNextEst 更好的名称是 Mammals(相机陷印)。谢谢你的提问!
    • 您最初的答案实际上是正确的!我正在尝试估计森林中哺乳动物物种的数量(可见和不可见)。仅记录了 C_notatus 和 R_tiomanicus,iNEXT 应该估计样本完整性的程度(我的调查有多彻底),然后根据遇到的新物种的比率可能有多少物种。因此,在一个物种贫乏的森林中(我们不经常遇到新物种),通常估计值会接近观察到的任何值,样本覆盖率/完整性会接近 1。这里很可能就是这种情况。
    猜你喜欢
    • 1970-01-01
    • 2012-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-14
    • 2023-03-04
    相关资源
    最近更新 更多