Version: | 1.1.1 |
Date: | 2025-03-29 |
Title: | Rarefaction-Based Species Richness Estimator |
Maintainer: | Peng Zhao <pengzhao20@outlook.com> |
Depends: | R (≥ 3.5.0) |
Imports: | Rdpack |
RdMacros: | Rdpack |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
VignetteBuilder: | knitr |
Description: | Calculate rarefaction-based alpha- and beta-diversity. Offer parametric extrapolation to estimate the total expected species in a single community and the total expected shared species between two communities. Visualize the curve-fitting for these estimators. |
License: | MIT + file LICENSE |
URL: | https://github.com/pzhaonet/rarestR, https://pzhaonet.github.io/rarestr/ |
BugReports: | https://github.com/pzhaonet/rarestR/issues |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
LazyData: | true |
Config/testthat/edition: | 3 |
Packaged: | 2025-03-30 05:05:59 UTC; DELL |
Author: | Peng Zhao |
Repository: | CRAN |
Date/Publication: | 2025-03-30 05:20:02 UTC |
Calculate the Expected Species
Description
Calculate the Expected Species
Usage
es(x, m, method = c("a", "b"), MARGIN = 1)
Arguments
x |
a data vector representing number of individuals for each species |
m |
the sample size parameter that represents the number of individuals randomly drawn from the sample. For ESa, m can not be larger than the sample size |
method |
the calculation approach of Expected Species used, with two options available as "a" and "b" to calculate ESa and ESb, with the default set as "a" |
MARGIN |
a vector giving the subscripts which the function will be applied over, see 'apply'. |
Value
a value of Expected Species
References
Zou Y, Zhao P, Wu N, Lai J, Peres-Neto PR, Axmacher JC (2025).
“rarestR: An R Package Using Rarefaction Metrics to Estimate \alpha
-and \beta
-Diversity for Incomplete Samples.”
Diversity and Distributions, 31(1), e13954.
doi:10.1111/ddi.13954.
Examples
data(share, package = 'rarestR')
rowSums(share) #The sum size of each sample is 100, 150 and 200
es(share, m = 100)
es(share, method = "b", m = 100)
# When the m is larger than the total sample size, "NA" will be filled:
es(share, m = 150)
Compute dissimilarity estimates between two samples based on Expected Species Shared (ESS)-measures, using abundance data for the species contained in each samples
Description
Compute dissimilarity estimates between two samples based on Expected Species Shared (ESS)-measures, using abundance data for the species contained in each samples
Usage
ess(x, m = 1, index = "CNESSa")
Arguments
x |
a community data matrix (sample x species); sample name is the row name of the matrix |
m |
the sample size parameter that represents the number of individuals randomly drawn from each sample, which by default is set to m=1, but can be changed according to the users' requirements. Rows with a total sample size <m will be excluded automatically from the analysis. |
index |
the distance measure used in the calculation, as one of the four options "CNESSa", "CNESS","NESS" and "ESS", with the default set as "CNESSa" |
Value
a pair-wised matrix
References
Zou Y, Zhao P, Wu N, Lai J, Peres-Neto PR, Axmacher JC (2025).
“rarestR: An R Package Using Rarefaction Metrics to Estimate \alpha
-and \beta
-Diversity for Incomplete Samples.”
Diversity and Distributions, 31(1), e13954.
doi:10.1111/ddi.13954.
Examples
data(share, package = 'rarestR')
ess(share)
ess(share, m = 100)
ess(share, m = 100, index = "ESS")
Plot the "rarestr" class
Description
Plot the "rarestr" class
Usage
## S3 method for class 'rarestr'
plot(x, ...)
Arguments
x |
a "rarestr" object |
... |
other arguments passed to plot() |
Value
Plot the "rarestr" class
Examples
data(share, package = 'rarestR')
Output_tes <- tes(share[1,])
Output_tes
plot(Output_tes)
Plot fitted curve for TES
Description
Plot fitted curve for TES
Usage
plot_tes(TES_output, ...)
Arguments
TES_output |
the output from tes() |
... |
other arguments passed to plot() |
Value
a plot
Plot fitted curve for TESS
Description
Plot fitted curve for TESS
Usage
plot_tess(TESS_output, ...)
Arguments
TESS_output |
the output from tess() |
... |
other arguments passed to plot() |
Value
a plot
Print the "rarestr" class
Description
This function prints the contents of a rarestr object.
Usage
## S3 method for class 'rarestr'
print(x, ...)
Arguments
x |
a "rarestr" object#' |
... |
Other arguments passed to print(). |
Value
Print the "rarestr" class
Examples
data(share, package = 'rarestR')
Output_tes <- tes(share[1,])
Output_tes
Dataset for rarestR.
Description
This is a dataset comprises three samples randomly drawn from three simulated communities. Every community consists of 100 species with approximately 100,000 individuals following a log-normal distribution (mean = 6.5, SD = 1). Setting the first community as control group, the second and third community shared a total of 25 and 50 species with the control. A more detailed description of the control and scenario groups can be found in Zou and Axmacher (2021). The share dataset represents a random subsample of 100, 150 and 200 individuals from three three communities, containing 58, 57 and 74 species, respectively.
Usage
share
Format
An object of class matrix
(inherits from array
) with 3 rows and 142 columns.
References
Zou Y, Zhao P, Wu N, Lai J, Peres-Neto PR, Axmacher JC (2025).
“rarestR: An R Package Using Rarefaction Metrics to Estimate \alpha
-and \beta
-Diversity for Incomplete Samples.”
Diversity and Distributions, 31(1), e13954.
doi:10.1111/ddi.13954.
Calculation of Total Expected Species base on ESa, ESb and their average value
Description
Calculation of Total Expected Species base on ESa, ESb and their average value
Usage
tes(x)
Arguments
x |
a data vector representing number of individuals for each species |
Details
The value returned by the tes()
function in the 'rarestr' class is a list containing three parts:
- par
A data frame of the summary of the estimated values and their standard deviations based on TESa, TESb, and TESab, and the model used in the estimation of TES, either 'logistic' or 'Weibull'.
- TESa
A list of the modeled results with the TESa method.
- TESb
A list of the modeled results with the TESb method.
Both TESa and TESb contain five parts, including a data frame of the parameters ($par
), a data frame of the simulated results ($result
), a maximum x value ($xmax
), a vector of the predicted x value ($Predx
), and a vector of the predicted y value ($Predy
)
Value
a list in a self-defined class 'rarestr'. See "Details".
References
Zou Y, Zhao P, Wu N, Lai J, Peres-Neto PR, Axmacher JC (2025).
“rarestR: An R Package Using Rarefaction Metrics to Estimate \alpha
-and \beta
-Diversity for Incomplete Samples.”
Diversity and Distributions, 31(1), e13954.
doi:10.1111/ddi.13954.
Examples
data(share, package = 'rarestR')
Output_tes <- tes(share[1,])
Output_tes
Calculate the Total number of Expected Shared Species between two samples.
Description
Calculate the Total number of Expected Shared Species between two samples.
Usage
tess(x)
Arguments
x |
a data matrix for two samples representing two communities (plot x species) |
Details
The value returned by the tess()
function in the 'rarestr' class is a list containing five parts:
- par
A data frame of the summary of the estimated values and their standard deviations based on TESa, TESb, and TESab, and the model used in the estimation of TES, either 'logistic' or 'Weibull'.
- result
A data frame of the simulated results.
- xmax
A maximum x value.
- Predx
A vector of the predicted x value.
- Predy
A vector of the predicted y value.
Value
a list in a self-defined class 'rarestr'. See "Details".
References
Zou Y, Zhao P, Wu N, Lai J, Peres-Neto PR, Axmacher JC (2025).
“rarestR: An R Package Using Rarefaction Metrics to Estimate \alpha
-and \beta
-Diversity for Incomplete Samples.”
Diversity and Distributions, 31(1), e13954.
doi:10.1111/ddi.13954.
Examples
data(share, package = 'rarestR')
Output_tess <- tess(share[1:2,])
Output_tess