https://github.com/pzhaonet/rarestr
An R Package of Rarefaction-Based Species Richness Estimator
https://github.com/pzhaonet/rarestr
biodiversity ecology r
Last synced: 20 days ago
JSON representation
An R Package of Rarefaction-Based Species Richness Estimator
- Host: GitHub
- URL: https://github.com/pzhaonet/rarestr
- Owner: pzhaonet
- License: other
- Created: 2023-09-06T05:23:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-30T03:48:11.000Z (about 2 months ago)
- Last Synced: 2025-05-05T01:02:48.159Z (20 days ago)
- Topics: biodiversity, ecology, r
- Language: R
- Homepage: https://pzhaonet.github.io/rarestr/
- Size: 1.31 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/pzhaonet/rarestr/actions/workflows/R-CMD-check.yaml)
## Introduction**rarestR** is an R package of rarefaction-based species richness
estimator. This package is designed to calculate rarefaction-based *α*-
and *β*-diversity. It also offers parametric extrapolation to estimate
the total expected species in a single community and the total expected
shared species between two communities. The package also provides
visualization of the curve-fitting for these estimators.## Installation
# Stable version
install.packages('rarestR')
# Development version
remotes::install_github('pzhaonet/rarestR')## Load rarestR and the demo dataset
library(rarestR)
data("share")The dataset **share** is a matrix with 3 rows and 142 columns. It
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.## Calculate the Expected Species
es(share, m = 100)
## 1 2 3
## 58.00000 47.77653 53.00568es(share, method = "b", m = 100)
## 1 2 3
## 43.51041 40.74378 46.19118# When the m is larger than the total sample size, "NA" will be filled:
es(share, m = 150)## Warning in es(y, m, method): m can not be larger than the total sample size
## 1 2 3
## NA 57.00000 65.24147## Compute dissimilarity estimates between two samples based on Expected Species Shared (ESS)-measures
ess(share)
## 1 2
## 2 0.7970962
## 3 0.6359703 0.7642330ess(share, m = 100)
## 1 2
## 2 0.8566624
## 3 0.7308390 0.8229221ess(share, m = 100, index = "ESS")
## 1 2
## 2 13.01735
## 3 22.65674 13.23924## Calculate and visualize the Total Expected Species base on ESa, ESb and their average value
Output_tes <- tes(share[1,])
Output_tes## est est.sd model.par
## TESa 138.50 2.46 logistic
## TESb 92.63 32.65 Weibull
## TESab 115.56 16.37plot(Output_tes)
## Calculate and visualize the Total number of Expected Shared Species between two samples
Output_tess <- tess(share[1:2,])
Output_tess## est est.sd model.par
## 1 23.28 2.59 logisticplot(Output_tess)
## Reference
Zou Y, Zhao P, Wu N, Lai J, Peres-Neto PR, Axmacher JC (2025). “rarestR: An R Package Using Rarefaction Metrics to Estimate α- and β-Diversity for Incomplete Samples.” _Diversity and Distributions_, *31*(1), e13954. [doi:10.1111/ddi.13954](https://doi.org/10.1111/ddi.13954).