BiodiversityR
:exclamation: This is a read-only mirror of the CRAN R package repository. BiodiversityR — Package for Community Ecology and Suitability Analysis. Homepage: http://www.worldagroforestry.org/output/tree-diversity-analysis
Install / Use
/learn @cran/BiodiversityRREADME
BiodiversityR
BiodiversityR is an R package for statistical analysis of biodiversity
and ecological communities, including species accumulation curves,
diversity indices, Renyi profiles, GLMs for analysis of species
abundance and presence-absence, distance matrices, Mantel tests, and
cluster, constrained and unconstrained ordination analysis.
The package was initially built to provide a graphical user interface
and different helper functions for the vegan community ecology
package. As documented in a manual on biodiversity and community ecology
analysis, available from this
website
and this
link,
most analysis pipelines require a community matrix (typically having
sites as rows, species as columns and abundance values as cell values)
and an environmental data set (typically providing numerical and
categorical variables for the different sites) as inputs. After being
launched on CRAN, new methods from vegan have been integrated in the
package as documented in the ChangeLog file.
A major update of BiodiversityR involved the inclusion of different
methods of ensemble suitability modelling, as described
here. Most of the
functions for ensemble suitability modelling were named with a
ensemble.XXXX() naming template.
At the end of 2021, some methods to facilitate plotting results via
ggplot were included in BiodiversityR. These methods are described
in detail in this rpubs series, with
some examples given below.
Packages needed
library(BiodiversityR) # also loads vegan
library(ggplot2)
library(ggforce)
library(concaveman)
library(ggrepel)
library(ggsci)
library(dplyr)
library(pvclust)
Data
The data in the examples are data that were used as case study in Data Analysis in Community and Landscape Ecology and also in the Tree Diversity Analysis manual.
Data set dune is a community data set, where variables (columns) typically correspond to different species and data represents abundance of each species. Species names were abbreviated to eight characters, with for example Agrostol representing Agrostis stolonifera.
data(dune)
str(dune)
#> 'data.frame': 20 obs. of 30 variables:
#> $ Achimill: num 1 3 0 0 2 2 2 0 0 4 ...
#> $ Agrostol: num 0 0 4 8 0 0 0 4 3 0 ...
#> $ Airaprae: num 0 0 0 0 0 0 0 0 0 0 ...
#> $ Alopgeni: num 0 2 7 2 0 0 0 5 3 0 ...
#> $ Anthodor: num 0 0 0 0 4 3 2 0 0 4 ...
#> $ Bellpere: num 0 3 2 2 2 0 0 0 0 2 ...
#> $ Bromhord: num 0 4 0 3 2 0 2 0 0 4 ...
#> $ Chenalbu: num 0 0 0 0 0 0 0 0 0 0 ...
#> $ Cirsarve: num 0 0 0 2 0 0 0 0 0 0 ...
#> $ Comapalu: num 0 0 0 0 0 0 0 0 0 0 ...
#> $ Eleopalu: num 0 0 0 0 0 0 0 4 0 0 ...
#> $ Elymrepe: num 4 4 4 4 4 0 0 0 6 0 ...
#> $ Empenigr: num 0 0 0 0 0 0 0 0 0 0 ...
#> $ Hyporadi: num 0 0 0 0 0 0 0 0 0 0 ...
#> $ Juncarti: num 0 0 0 0 0 0 0 4 4 0 ...
#> $ Juncbufo: num 0 0 0 0 0 0 2 0 4 0 ...
#> $ Lolipere: num 7 5 6 5 2 6 6 4 2 6 ...
#> $ Planlanc: num 0 0 0 0 5 5 5 0 0 3 ...
#> $ Poaprat : num 4 4 5 4 2 3 4 4 4 4 ...
#> $ Poatriv : num 2 7 6 5 6 4 5 4 5 4 ...
#> $ Ranuflam: num 0 0 0 0 0 0 0 2 0 0 ...
#> $ Rumeacet: num 0 0 0 0 5 6 3 0 2 0 ...
#> $ Sagiproc: num 0 0 0 5 0 0 0 2 2 0 ...
#> $ Salirepe: num 0 0 0 0 0 0 0 0 0 0 ...
#> $ Scorautu: num 0 5 2 2 3 3 3 3 2 3 ...
#> $ Trifprat: num 0 0 0 0 2 5 2 0 0 0 ...
#> $ Trifrepe: num 0 5 2 1 2 5 2 2 3 6 ...
#> $ Vicilath: num 0 0 0 0 0 0 0 0 0 1 ...
#> $ Bracruta: num 0 0 2 2 2 6 2 2 2 2 ...
#> $ Callcusp: num 0 0 0 0 0 0 0 0 0 0 ...
Data set dune.env is an environmental data set, where variables (columns) correspond to different descriptors (typically continuous and categorical variables) of the sample sites. One of the variables is Management, a categorical variable that describes different management categories, coded as BF (an abbreviation for biological farming), HF (hobby farming), NM (nature conservation management) and SF (standard farming).
data(dune.env)
summary(dune.env)
#> A1 Moisture Management Use Manure
#> Min. : 2.800 1:7 BF:3 Hayfield:7 0:6
#> 1st Qu.: 3.500 2:4 HF:5 Haypastu:8 1:3
#> Median : 4.200 4:2 NM:6 Pasture :5 2:4
#> Mean : 4.850 5:7 SF:6 3:4
#> 3rd Qu.: 5.725 4:3
#> Max. :11.500
For some plotting methods, it is necessary that the environmental data set is attached:
attach(dune.env)
Ordination model
For the examples, we use the constrained ordination method of redundancy analysis.
The ordiplot object is obtained from the result of via function rda. The ordination is done with a community data set that is transformed by the Hellinger method as recommended in this article.
# script generated by the BiodiversityR GUI from the constrained ordination menu
dune.Hellinger <- disttransform(dune, method='hellinger')
Ordination.model1 <- rda(dune.Hellinger ~ Management,
data=dune.env,
scaling="species")
summary(Ordination.model1)
#>
#> Call:
#> rda(formula = dune.Hellinger ~ Management, data = dune.env, scaling = "species")
#>
#> Partitioning of variance:
#> Inertia Proportion
#> Total 0.5559 1.0000
#> Constrained 0.1667 0.2999
#> Unconstrained 0.3892 0.7001
#>
#> Eigenvalues, and their contribution to the variance
#>
#> Importance of components:
#> RDA1 RDA2 RDA3 PC1 PC2 PC3 PC4
#> Eigenvalue 0.09377 0.05304 0.01988 0.1279 0.05597 0.04351 0.03963
#> Proportion Explained 0.16869 0.09542 0.03575 0.2300 0.10069 0.07827 0.07129
#> Cumulative Proportion 0.16869 0.26411 0.29986 0.5299 0.63054 0.70881 0.78010
#> PC5 PC6 PC7 PC8 PC9 PC10 PC11
#> Eigenvalue 0.03080 0.02120 0.01623 0.01374 0.01138 0.009469 0.007651
#> Proportion Explained 0.05541 0.03814 0.02919 0.02471 0.02047 0.017034 0.013764
#> Cumulative Proportion 0.83551 0.87365 0.90284 0.92755 0.94802 0.965056 0.978820
#> PC12 PC13 PC14 PC15 PC16
#> Eigenvalue 0.003957 0.003005 0.002485 0.001670 0.0006571
#> Proportion Explained 0.007117 0.005406 0.004470 0.003004 0.0011821
#> Cumulative Proportion 0.985937 0.991344 0.995814 0.998818 1.0000000
#>
#> Accumulated constrained eigenvalues
#> Importance of components:
#> RDA1 RDA2 RDA3
#> Eigenvalue 0.09377 0.05304 0.01988
#> Proportion Explained 0.56255 0.31822 0.11923
#> Cumulative Proportion 0.56255 0.88077 1.00000
#>
#> Scaling 2 for species and site scores
#> * Species are scaled proportional to eigenvalues
#> * Sites are unscaled: weighted dispersion equal on all dimensions
#> * General scaling constant of scores: 1.80276
#>
#>
#> Species scores
#>
#> RDA1 RDA2 RDA3 PC1 PC2 PC3
#> Achimill 0.036568 0.127978 0.016399 -0.188968 -0.070111 0.175399
#> Agrostol -0.003429 -0.270611 -0.018285 0.361207 0.005321 -0.014204
#> Airaprae -0.127487 -0.011618 -0.005281 -0.120126 0.103133 0.060671
#> Alopgeni 0.235229 -0.190348 0.027102 0.163865 0.129547 -0.078901
#> Anthodor -0.085534 0.115742 -0.079991 -0.240230 0.117203 0.201272
#> Bellpere 0.033345 0.041954 0.083723 -0.081623 -0.079661 -0.076104
#> Bromhord 0.093316 0.120369 0.065335 -0.058227 -0.047198 0.043097
#> Chenalbu 0.016343 -0.027339 0.008563 0.006896 0.028380 0.004920
#> Cirsarve 0.019792 -0.033109 0.010370 -0.009773 -0.008401 -0.025099
#> Comapalu -0.110016 -0.010026 -0.004558 0.091463 -0.045993 0.026311
#> Eleopalu -0.160847 -0.069849 -0.041472 0.352544 -0.115164 0.126956
#> Elymrepe 0.173955 -0.047695 -0.002020 -0.108520 -0.206622 -0.115376
#> Empenigr -0.047886 -0.004364 -0.001984 -0.029817 0.061163 -0.018612
#> Hyporadi -0.130851 0.036162 0.047182 -0.127285 0.148136 0.027482
#> Juncarti -0.057086 -0.003074 -0.101556 0.265930 -0.061713 -0.009618
#> Juncbufo 0.102986 -0.052188 -0.062882 0.033316 0.152206 -0.038314
#> Lolipere 0.260211 0.153503 0.052002 -0.192751 -0.234269 -0.146056
#> Planlanc -0.018339 0.192788 -0.064491 -0.222661 0.025888 0.091459
#> Poaprat 0.183546 0.093202 0.019068 -0.196708 -0.136129 -0.115068
#> Poatriv 0.377233 -0.046485 -0.039312 -0.019700 -0.010085 0.010877
#> Ranuflam -0.113470 -0.073249 -0.022781 0.249877 -0.046445 0.073742
#> Rumeacet 0.118187 0.070051 -0.198589 -0.056786 0.065922 0.042193
#> Sagiproc 0.076848 -0.060054 0.017557 0.035039 0.222856 -0.152162
#> Salirepe -0.197203 -0.017971 -0.008170 -0.014209 0.015031 -0.104243
#> Scorautu -0.146131 0.134240 0.015763 -0.059562 0.117768 -0.088453
#> Trifprat 0.061485 0.069094 -0.135080 -0.066713 -0.001921 0.069306
#> Trifrepe 0.010076 0.151446 0.031054 0.039480 0.082043 -0.081712
#> Vicilath -0.014220 0.076123 0.084100 -0.026628 0.009338 -0.057100
#> Bracruta -0.057834 0.021502 -0.054847 0.083143 0.070717 -0.115855
#> Callcusp -0.107307 -0.059711 0.009214 0.169330 -0.068364 0.107835
#>
#>
#> Site scores (weighted sums of species scores)
#>
#> RDA1 RDA2 RDA3 PC1 PC2 PC3
#> 1 0.58
Related Skills
node-connect
334.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
334.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.3kCommit, push, and open a PR
