- Notifications
You must be signed in to change notification settings - Fork0
EricMarcon/divent
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
divent is an R package that provides functions to estimate alpha,beta and gamma diversity of communities, including phylogenetic andfunctional diversity.
It is a reboot of the packageentropart to make it tidy, easier touse and optimize the code that has been added along years of research.
You can install the development version of divent fromGitHub with:
# install.packages("pak")pak::pak("EricMarcon/divent")
In the divent package, individuals of differentspecies are counted inseveralcommunities which may (or not) be aggregated to define ametacommunity. In the metacommunity, the probability to find a speciesin the weighted average of probabilities in communities. This is anaming convention, which may correspond to plots in a forest inventoryor any data organized the same way.
# Abundances of three communities with four speciesabd<-matrix( c(10,0,25,10,20,15,10,35,0,10,5,2 ),ncol=4)# Community weightsw<- c(1,2,1)# Organize the datalibrary("divent")abd|> as_abundances(weights=w)|># Plot it plot(type="Metacommunity")
Basic functions allow computing diversity of a community. Example datais a 6.25ha plot of rainforest in Paracou, French Guiana, divided into 4subplots.
paracou_6_abd|> autoplot()
Entropies such as Shannon’s, Simpson’s, or Hurlbert’s, and explicitdiversity (i.e. effective number of species), aka Hill numbers, areestimated.
# Diversity of a tropical rainforestdiv_richness(paracou_6_abd)#> # A tibble: 4 × 5#> site weight estimator order diversity#> <chr> <dbl> <chr> <dbl> <dbl>#> 1 subplot_1 1.56 Jackknife 3 0 355#> 2 subplot_2 1.56 Jackknife 2 0 348#> 3 subplot_3 1.56 Jackknife 2 0 315#> 4 subplot_4 1.56 Jackknife 2 0 296ent_shannon(paracou_6_abd)#> # A tibble: 4 × 5#> site weight estimator order entropy#> <chr> <dbl> <chr> <dbl> <dbl>#> 1 subplot_1 1.56 UnveilJ 1 4.57#> 2 subplot_2 1.56 UnveilJ 1 4.73#> 3 subplot_3 1.56 UnveilJ 1 4.65#> 4 subplot_4 1.56 UnveilJ 1 4.55ent_simpson(paracou_6_abd)#> # A tibble: 4 × 5#> site weight estimator order entropy#> <chr> <dbl> <chr> <dbl> <dbl>#> 1 subplot_1 1.56 Lande 2 0.976#> 2 subplot_2 1.56 Lande 2 0.978#> 3 subplot_3 1.56 Lande 2 0.980#> 4 subplot_4 1.56 Lande 2 0.972
By default, the best available estimator of diversity is used, accordingto the data. Diversity profiles are estimated.
profile_hill(paracou_6_abd) %>%autoplot
Communities can be simulated and plotted.
rc<- rcommunity(1,size=10000,distribution="lnorm")autoplot(rc,fit_rac=TRUE,distribution="lnorm")
Phylogenetic entropy and diversity can be calculated if a phylogenetic(or functional), ultrametric tree is provided, with the state-of-the-artestimation-bias correction.
# Phylogenetic diversity of order 1, based on the taxonomydiv_phylo(paracou_6_abd,tree=paracou_6_taxo,q=1)#> # A tibble: 4 × 4#> site weight estimator diversity#> <chr> <dbl> <chr> <dbl>#> 1 subplot_1 1.56 UnveilJ 41.0#> 2 subplot_2 1.56 UnveilJ 52.9#> 3 subplot_3 1.56 UnveilJ 46.1#> 4 subplot_4 1.56 UnveilJ 43.2
Similarity-based diversity is calculated, based on a similarity matrix.
# Similarity is computed from the functional distance matrix of Paracou speciesZ<- fun_similarity(paracou_6_fundist)# Calculate diversity of order 2div_similarity(paracou_6_abd,similarities=Z,q=2)#> # A tibble: 4 × 5#> site weight estimator order diversity#> <chr> <dbl> <chr> <dbl> <dbl>#> 1 subplot_1 1.56 UnveilJ 2 1.31#> 2 subplot_2 1.56 UnveilJ 2 1.33#> 3 subplot_3 1.56 UnveilJ 2 1.32#> 4 subplot_4 1.56 UnveilJ 2 1.30
The diversity of a metacommunity, i.e. $\gamma$ diversity, can bepartitioned into
# Partitioning of diversity of order 1 (Shannon)div_part(paracou_6_abd,q=1)#> # A tibble: 7 × 6#> site scale estimator order diversity weight#> <chr> <chr> <chr> <dbl> <dbl> <dbl>#> 1 Metacommunity gamma "UnveilJ" 1 111. 6.25#> 2 Metacommunity beta "" 1 1.09 NA#> 3 Metacommunity alpha "" 1 102. NA#> 4 subplot_1 community "UnveilJ" 1 96.3 1.56#> 5 subplot_2 community "UnveilJ" 1 113. 1.56#> 6 subplot_3 community "UnveilJ" 1 105. 1.56#> 7 subplot_4 community "UnveilJ" 1 94.6 1.56
A quickintroductionis invignette("divent").
A full documentation is available online, in the “Articles” section ofthe web site of the vignette.
Thedocumentation of the developmentversion is also available.
Marcon, E. and Herault, B. (2015). entropart: An R Package to Measureand Partition Diversity.Journal of Statistical Software. 67(8): 1-26.
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.




