“素食”包的累积曲线标准差为0

Standard deviation is 0 in the accumulation curve of the “vegan” package

dados <- structure(list(Anos = c(2009L, 2015L, 2011L, 2007L, 2005L, 2013L
  ), Coluna1 = c(13L, 11L, 9L, 8L, 6L, 6L), Coluna2 = c(1L, 0L, 
  0L, 1L, 0L, 0L), Coluna3 = c(1L, 8L, 10L, 2L, 4L, 4L), Coluna4 = c(7L, 
  5L, 2L, 5L, 7L, 1L)), class = "data.frame", row.names = c(NA, 
  -6L))

library(vegan)

resultado <- specaccum(dados)

> Warning message:
In cor(x > 0): standard deviation is zero    

richness <- resultado$richness
sd <- resultado$sd
sites <- resultado$sites

y.mínimo <- min(richness)
y.máximo <- max(richness)

y.baixo <- y.mínimo*0.80
y.alto <- y.máximo+(y.mínimo*0.10)

limites.y <- c(y.baixo, y.alto)
plot(riqueza ~ amostras, type = "l",
 ylim = limites.y, xlim = c(1, 9), las = 1, xlab = "Esforço amostral",
 ylab = "Riqueza de espécies")

arrows(amostras, riqueza-desvio, amostras, riqueza+desvio,
 angle = 90, code = 3, length = 0.05)

points(riqueza ~ amostras, pch = 21, bg = "white")

图表是这样的:https://imgur.com/a/0ndkplQ

有谁知道我该如何修正我的数据(或代码),以便图表看起来大致如下所示? https://imgur.com/a/M2qgunl

这是使用您的数据构建所需图的简单方法。如果您想构建一个更好的情节,我建议您查看 iNEXT 包。

library(vegan)

#Convert data frame to matrix
dados_matrix<-as.matrix(dados[,-1])
#Name rows as the first column in original df
row.names(dados_matrix)<-dados[,1]

#Do the specaccum function
resultado <- specaccum(dados_matrix)

#Plot
plot(resultado,
     xlab = "Esforço amostral",
     ylab = "Riqueza de espécies",
     #Multiplier to calculate confidence intervals based on sd
     #In this example error bars are calculated as the mean +/- 1.96 sd
     ci = 1.96,
     #Type of confidence intervals
     ci.type = "bar",
     #Length of error bars (i.e., horizontal lines)
     ci.length = 0.1,
     #line width
     lwd = 1.8)