-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.Rmd
93 lines (73 loc) · 4.07 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# mmir <img src='man/figures/logo.png' align="right" height="115" />
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/mmir)](https://CRAN.R-project.org/package=mmir)
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![Travis build status](https://travis-ci.org/zsmith27/mmir.svg?branch=master)](https://travis-ci.org/zsmith27/mmir)
[![Codecov test coverage](https://codecov.io/gh/zsmith27/mmir/branch/master/graph/badge.svg)](https://codecov.io/gh/zsmith27/mmir?branch=master)
<!-- badges: end -->
It is common practice for regulatory agencies to use biological communities, such as macroinvertebrate, fish, or diatoms, to evaluate water quality condition. Multi-Metric Indices (MMI) or Indices of Biotic Integrity are the standard models for biological assessment, yet there is no package in R specifically dedicated to calculating common or exploratory biological community metrics. The mmir (Multi-Metrics Indices in R) package is intended to simplify and standardize the production of biological community metrics within R. The package provides a straightforward syntax for calculating richness, diversity (e.g., Shannon-Wiener and Simpsons), relative abundance, dominance, functional feeding group, habit, and tolerance value metrics. Building on this base functionality for calculating these individual metrics, there are built in functions for iterating through each metric type to provide a large suite of exploratory metrics; for example, with a single call relative abundance metrics for all orders, families, genera, and species in a dataset can be generated. These exploratory metrics must be reviewed for ecological context, but the limitation of calculating new metrics or evaluating new aspects of the community has been substantially reduced.
## Installation
You can install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("zsmith27/mmir")
```
## Metrics
Below is a list of functions provided by __mmir__ for calculating biological metrics:
1. `taxa_rich()`calculates taxonomic richness.
2. `taxa_pct_rich()` calculates relative taxonomic richness.
3. `taxa_div()` calculates taxonomic diversity indices.
4. `taxa_abund()` calculates taxonomic abundance.
5. `taxa_pct()` calculates relative taxonomic abundance.
6. `taxa_dom()` calculates relative taxonomic dominance.
7. `taxa_tol()` calculates taxonomic tolerance indices.
## Usage
This is a basic example which shows you how to call each of biological metric functions.
```{r example}
library(mmir)
data("nrsa_nap_0809")
taxa_rich(.dataframe = nrsa_nap_0809,
.key_col = uid,
.counts_col = total,
.group_col = target_taxon)
taxa_pct_rich(.dataframe = nrsa_nap_0809,
.key_col = uid,
.counts_col = total,
.group_col = target_taxon,
.filter = order %in% c("ephemeroptera",
"plecoptera",
"trichoptera"))
taxa_abund(.dataframe = nrsa_nap_0809,
.key_col = uid,
.counts_col = total,
.filter = order %in% c("ephemeroptera",
"plecoptera",
"trichoptera"))
taxa_pct(.dataframe = nrsa_nap_0809,
.key_col = uid,
.counts_col = total,
.filter = order %in% c("ephemeroptera",
"plecoptera",
"trichoptera"))
taxa_dom(.dataframe = nrsa_nap_0809,
.key_col = uid,
.counts_col = total,
.group_col = target_taxon,
.dom_level = 1)
taxa_tol_index(.dataframe = nrsa_nap_0809,
.key_col = uid,
.counts_col = total,
.tol_col = ptv)
```