-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathREADME.Rmd
108 lines (77 loc) · 4.22 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "##",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
[![DOI](http://joss.theoj.org/papers/10.21105/joss.01041/status.svg)](https://doi.org/10.21105/joss.01041) [![Build Status](https://travis-ci.org/daijiang/hillR.svg?branch=master)](https://app.travis-ci.com/github/daijiang/hillR) [![Coverage status](https://codecov.io/gh/daijiang/hillR/branch/master/graph/badge.svg)](https://app.codecov.io/github/daijiang/hillR?branch=master)
[![CRAN status](https://www.r-pkg.org/badges/version/hillR)](https://cran.r-project.org/package=hillR)
[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/hillR)](https://www.r-pkg.org/pkg/hillR)
[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/grand-total/hillR?color=green)](https://www.r-pkg.org/pkg/hillR)
# 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:
```{r, eval=FALSE}
install.packages("hillR")
# or install from Github
install.packages("hillR", repos = c('https://daijiang.r-universe.dev', 'https://cloud.r-project.org'))
```
# Examples
```{r data}
dummy = FD::dummy
comm = dummy$abun
traits = dummy$trait
set.seed(123)
tree = ape::rtree(n = ncol(comm), tip.label = paste0("sp", 1:ncol(comm)))
library(hillR)
```
## Calculate taxonomic, functional, and phylogenetic diversity of each site
```{r}
hill_taxa(comm, q = 0) # taxonomic alpha diversity
hill_func(comm, traits, q = 0) # functional alpha diversity
hill_phylo(comm, tree, q = 0) # phylogenetic alpha diversity
```
## Calculate taxonomic, functional, and phylogenetic diversity across multiple sites
```{r}
hill_taxa_parti(comm, q = 0) # taxonomic diversity across all sites
hill_func_parti(comm, traits, q = 0) # functional diversity across all sites
hill_phylo_parti(comm, tree, q = 0) # phylogenetic diversity across all sites
```
## Calculate pairwise taxonomic, functional, and phylogenetic diversity
```{r}
# pairwise taxonomic diversity
hill_taxa_parti_pairwise(comm, q = 0, show_warning = FALSE, .progress = FALSE)
# pairwise functional diversity
hill_func_parti_pairwise(comm, traits, q = 0, show_warning = FALSE, .progress = FALSE)
# pairwise phylogenetic diversity
hill_phylo_parti_pairwise(comm, tree, q = 0, show_warning = FALSE, .progress = FALSE)
```
# Licenses
Licensed under the [MIT license](LICENSE). ([More information here](https://en.wikipedia.org/wiki/MIT_License).)
# 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
```bibtex
@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
- [Chao, Anne, Chun-Huo Chiu, and Lou Jost. “Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers.” Annual Review of Ecology, Evolution, and Systematics 45, no. 1 (2014): 297–324. doi:10.1146/annurev-ecolsys-120213-091540.](https://doi.org/10.1146/annurev-ecolsys-120213-091540)
- [Chiu, Chun-Huo, and Anne Chao. “Distance-Based Functional Diversity Measures and Their Decomposition: A Framework Based on Hill Numbers.” PLoS ONE 9, no. 7 (July 7, 2014): e100014. doi:10.1371/journal.pone.0100014.](https://doi.org/10.1371/journal.pone.0100014)
# Contributing
Contributions are welcome. You can provide comments and feedback or ask questions by filing an issue on Github [here](https://github.com/daijiang/hillR/issues) or making pull requests.