Skip to content
An R pakage to calculate diversity through Hill Numbers
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
inst send to CRAN Nov 14, 2018
joss Merge branch 'master' of https://github.com/daijiang/hillR Nov 8, 2018
man send to CRAN Nov 14, 2018
tests
.Rbuildignore
.gitignore
.travis.yml Update .travis.yml Nov 13, 2018
CRAN-RELEASE send to CRAN Nov 14, 2018
DESCRIPTION match trait species names to comm Apr 15, 2019
LICENSE updated taxa and func diversity Apr 12, 2018
LICENSE.md
NAMESPACE added phylo diversity hill numbers Apr 12, 2018
NEWS.md Increment version number Sep 13, 2018
README.Rmd update installation commands Jan 9, 2019
README.md
codecov.yml add coverage May 17, 2018
cran-comments.md send to CRAN Nov 14, 2018
hillR.Rproj

README.md

DOI Build Status Coverage status

hillR

This package contains R functions to calculate taxonomic, functional, and phylogenetic diversity and site similarity through Hill Numbers. The underlying methods are based on Chao, Chiu and Jost 2014 and Chiu & Chao 2014.

Installation

To install this package, run the following code:

install.packages("hillR")
# or install from Github
devtools::install_github("daijiang/hillR")

Examples

dummy = FD::dummy
comm = dummy$abun
traits = dummy$trait
tree = ape::rtree(n = ncol(comm), tip.label = paste0("sp", 1:ncol(comm)))
library(hillR)

Calculate taxonomic, functional, and phylogenetic diversity of each site

hill_taxa(comm, q = 0) # taxonomic alpha diversity
##  com1  com2  com3  com4  com5  com6  com7  com8  com9 com10 
##     4     3     3     2     3     5     3     4     5     4

hill_func(comm, traits, q = 0) # functional alpha diversity
##           com1      com2      com3      com4      com5      com6      com7
## Q    0.4016663 0.1922618 0.2780442 0.1146261 0.3816159  0.404177 0.2934143
## FDis 0.3481687 0.1670560 0.2375808 0.1146261 0.3211366  0.330233 0.2532751
## D_q  4.0974923 3.6518111 3.2454591 3.0237158 3.0655375  5.233241 3.1470056
## MD_q 1.6458245 0.7021037 0.9023810 0.3465969 1.1698580  2.115156 0.9233765
## FD_q 6.7437533 2.5639502 2.9286406 1.0480104 3.5862436 11.069121 2.9058708
##           com8       com9     com10
## Q    0.3343662  0.4156546 0.3844765
## FDis 0.2877931  0.3421687 0.3503927
## D_q  4.3998540  5.2114653 4.1694097
## MD_q 1.4711625  2.1661695 1.6030400
## FD_q 6.4729004 11.2889174 6.6837303

hill_phylo(comm, tree, q = 0) # phylogenetic alpha diversity
##     com1     com2     com3     com4     com5     com6     com7     com8 
## 8.080222 5.041672 6.945878 2.357757 4.892636 8.122602 5.384327 7.609754 
##     com9    com10 
## 7.072671 5.736685

Calculate taxonomic, functional, and phylogenetic diversity across multiple sites

hill_taxa_parti(comm, q = 0) # taxonomic diversity across all sites
##   q TD_gamma TD_alpha  TD_beta M_homog local_similarity region_similarity
## 1 0        8      3.6 2.222222    0.45        0.8641975         0.3888889

hill_func_parti(comm, traits, q = 0) # functional diversity across all sites
##   q raoQ_gamma FD_gamma FD_alpha FD_beta local_similarity
## 1 0  0.4529152 29.66099 14.15941 2.09479        0.9889415
##   region_similarity
## 1         0.4720957

hill_phylo_parti(comm, tree, q = 0) # phylogenetic diversity across all sites
##   q PD_gamma PD_alpha  PD_beta local_similarity region_similarity
## 1 0 9.136295  6.12442 1.491781        0.9453577         0.6337107

Calculate pairwise taxonomic, functional, and phylogenetic diversity

hill_taxa_parti_pairwise(comm, q = 0, show.warning = F) # pairwise taxonomic diversity
## # A tibble: 45 x 8
##        q site1 site2 TD_gamma TD_alpha TD_beta local_similarity
##    <dbl> <fct> <fct>    <dbl>    <dbl>   <dbl>            <dbl>
##  1     0 com1  com2         6      3.5    1.71            0.286
##  2     0 com1  com3         5      3.5    1.43            0.571
##  3     0 com2  com3         5      3      1.67            0.333
##  4     0 com1  com4         5      3      1.67            0.333
##  5     0 com2  com4         5      2.5    2               0    
##  6     0 com3  com4         4      2.5    1.6             0.400
##  7     0 com1  com5         6      3.5    1.71            0.286
##  8     0 com2  com5         4      3      1.33            0.667
##  9     0 com3  com5         6      3      2               0    
## 10     0 com4  com5         4      2.5    1.6             0.400
## # … with 35 more rows, and 1 more variable: region_similarity <dbl>

hill_func_parti_pairwise(comm, traits, q = 0, show.warning = F) # pairwise functional diversity
## # A tibble: 45 x 8
##        q site1 site2 FD_gamma FD_alpha FD_beta local_similarity
##    <dbl> <fct> <fct>    <dbl>    <dbl>   <dbl>            <dbl>
##  1     0 com1  com2     15.9     10.3     1.54            0.821
##  2     0 com1  com3     10.7      7.96    1.35            0.883
##  3     0 com2  com3     11.1      7.03    1.58            0.807
##  4     0 com1  com4     11.6      7.90    1.47            0.843
##  5     0 com2  com4     11.7      6.85    1.70            0.765
##  6     0 com3  com4      6.60     4.45    1.48            0.839
##  7     0 com1  com5     17.3     11.3     1.54            0.821
##  8     0 com2  com5      7.86     5.92    1.33            0.891
##  9     0 com3  com5     16.2      9.72    1.66            0.780
## 10     0 com4  com5      8.00     5.32    1.50            0.832
## # … with 35 more rows, and 1 more variable: region_similarity <dbl>

hill_phylo_parti_pairwise(comm, tree, q = 0, show.warning = F) # pairwise phylogenetic diversity
## # A tibble: 45 x 8
##        q site1 site2 PD_gamma PD_alpha PD_beta local_similarity
##    <dbl> <fct> <fct>    <dbl>    <dbl>   <dbl>            <dbl>
##  1     0 com1  com2      8.33     6.56    1.27            0.731
##  2     0 com1  com3      8.31     7.51    1.11            0.893
##  3     0 com2  com3      7.81     5.99    1.30            0.697
##  4     0 com1  com4      8.16     5.22    1.56            0.436
##  5     0 com2  com4      6.04     3.70    1.63            0.367
##  6     0 com3  com4      7.03     4.65    1.51            0.489
##  7     0 com1  com5      8.18     6.49    1.26            0.739
##  8     0 com2  com5      5.13     4.97    1.03            0.968
##  9     0 com3  com5      7.90     5.92    1.33            0.666
## 10     0 com4  com5      5.81     3.63    1.60            0.397
## # … with 35 more rows, and 1 more variable: region_similarity <dbl>

Licenses

Licensed under the MIT license. (More information here.)

Citation

Please cite this package if you use it. The citation information can be obtained by running citation('hillR') in R.

Li, (2018). hillR: taxonomic, functional, and phylogenetic diversity and similarity through Hill Numbers. Journal of Open Source Software, 3(31), 1041. https://doi.org/10.21105/joss.01041

@Article{,
    title = {hillR: taxonomic, functional, and phylogenetic diversity and similarity through Hill Numbers},
    author = {Daijiang Li},
    journal = {Journal of Open Source Software},
    year = {2018},
    volume = {3},
    number = {31},
    pages = {1041},
    url = {https://doi.org/10.21105/joss.01041},
 }

Reference

Contributing

Contributions are welcome. You can provide comments and feedback or ask questions by filing an issue on Github here or making pull requests.

You can’t perform that action at this time.