Reputation: 91
After resolving my previous issue, I've come to the next problem.
This time I believe it involves interpreting the results and is an issue with the data collected.
Here's the steps I took:
#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)
At this point, I get this error
Error in data.frame(do.call("rbind", z), site = rep(names(z), sapply(z, :
arguments imply differing number of rows: 40, 0
I wonder if it has to do with my actual data (maybe the fact that I have only one assemblage? I checked ct.inext and it gave me a sample coverage of 1 (see below: 100% sample coverage--is that even possible?)
> 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
Again, any help would be great!
Upvotes: 0
Views: 464
Reputation: 2949
Just a tweak. The error is because that ct.inext$iNextEst in unnamed. I just assigned a random name for ct.inext$iNextEst and it gave the plot.
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")
I a m not sure whether this is the answer you are expecting. I just pointed out the reason why the plot is not generating for your code.
P.S.: Since, I am not familiar with this analysis, I couldn't get why you are converting the Abundance values into binary, while the examples that I had looked at were not in binary.
Upvotes: 1