`richness()`

computes sample richness.`composition()`

computes asymptotic species richness.

## Usage

```
richness(object, ...)
composition(object, ...)
# S4 method for class 'matrix'
richness(object, ..., method = c("count", "margalef", "menhinick"))
# S4 method for class 'data.frame'
richness(object, ..., method = c("count", "margalef", "menhinick"))
# S4 method for class 'matrix'
composition(object, ..., method = c("chao1", "ace", "squares", "chao2", "ice"))
# S4 method for class 'data.frame'
composition(object, ..., method = c("chao1", "ace", "squares", "chao2", "ice"))
```

## Arguments

- object
A \(m \times p\)

`numeric`

`matrix`

or`data.frame`

of count data (absolute frequencies giving the number of individuals for each category, i.e. a contingency table). A`data.frame`

will be coerced to a`numeric`

`matrix`

via`data.matrix()`

.- ...
Further arguments to be passed to internal methods (see below).

- method
A

`character`

string or vector of strings specifying the index to be computed (see details). Any unambiguous substring can be given.

## Value

`richness()`

returns a RichnessIndex object.`composition()`

returns a CompositionIndex object.

## Details

The number of different taxa, provides an instantly comprehensible
expression of diversity. While the number of taxa within a sample
is easy to ascertain, as a term, it makes little sense: some taxa
may not have been seen, or there may not be a fixed number of taxa
(e.g. in an open system; Peet 1974). As an alternative, *richness*
(\(S\)) can be used for the concept of taxa number (McIntosh 1967).

It is not always possible to ensure that all sample sizes are equal
and the number of different taxa increases with sample size and
sampling effort (Magurran 1988). Then, *rarefaction*
(\(E(S)\)) is the number of taxa expected if all samples were of a
standard size (i.e. taxa per fixed number of individuals).
Rarefaction assumes that imbalances between taxa are due to sampling and
not to differences in actual abundances.

## Richness Measures

The following richness measures are available for count data:

`count`

Number of observed taxa/types.

`margalef`

`menhinick`

## Asymptotic Species Richness

The following measures are available for count data:

`ace`

`chao1`

(improved/unbiased) Chao1 estimator.

`squares`

The following measures are available for replicated incidence data:

`ice`

`chao2`

(improved/unbiased) Chao2 estimator.

## References

Kintigh, K. W. (1989). Sample Size, Significance, and Measures of
Diversity. In Leonard, R. D. and Jones, G. T., *Quantifying Diversity
in Archaeology*. New Directions in Archaeology. Cambridge:
Cambridge University Press, p. 25-36.

Magurran, A. E. (1988). *Ecological Diversity and its Measurement*.
Princeton, NJ: Princeton University Press. doi:10.1007/978-94-015-7358-0
.

Magurran, A E. & Brian J. McGill (2011). *Biological Diversity:
Frontiers in Measurement and Assessment*. Oxford: Oxford University Press.

McIntosh, R. P. (1967). An Index of Diversity and the Relation of Certain
Concepts to Diversity. *Ecology*, 48(3), 392-404. doi:10.2307/1932674
.

Peet, R. K. (1974). The Measurement of Species Diversity. *Annual Review of
Ecology and Systematics*, 5(1), 285-307.
doi:10.1146/annurev.es.05.110174.001441
.

## See also

`index_margalef()`

, `index_menhinick()`

, `index_ace()`

,
`index_chao1()`

, `index_squares()`

, `index_ice()`

, `index_chao2()`

Other diversity measures:
`heterogeneity()`

,
`occurrence()`

,
`profiles()`

,
`rarefaction()`

,
`she()`

,
`similarity()`

,
`simulate()`

,
`turnover()`

## Examples

```
## Data from Magurran 1988, p. 128-129
trap <- matrix(data = c(9, 3, 0, 4, 2, 1, 1, 0, 1, 0, 1, 1,
1, 0, 1, 0, 0, 0, 1, 2, 0, 5, 3, 0),
nrow = 2, byrow = TRUE, dimnames = list(c("A", "B"), NULL))
## Margalef and Menhinick index
richness(trap, method = "margalef") # 2.55 1.88
#> [1] 2.551432 1.949356
richness(trap, method = "menhinick") # 1.95 1.66
#> [1] 1.876630 1.664101
## Data from Chao & Chiu 2016
brazil <- matrix(
data = rep(x = c(1:21, 23, 25, 27, 28, 30, 32, 34:37, 41,
45, 46, 49, 52, 89, 110, 123, 140),
times = c(113, 50, 39, 29, 15, 11, 13, 5, 6, 6, 3, 4,
3, 5, 2, 5, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1,
0, 0, 2, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0)),
nrow = 1, byrow = TRUE
)
## Chao1-type estimators (asymptotic species richness)
composition(brazil, method = c("chao1"), unbiased = FALSE) # 461.625
#> [1] 461.6254
composition(brazil, method = c("ace"), k = 10) # 445.822
#> [1] 443.6836
```