Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

margalef

Margalef's richness index


Description

Margalef's richness index

Usage

margalef(x)

Arguments

x

A numeric vector of species counts.

Details

For a vector x of species counts, Margalef's index is

D = \frac{S -1}{\log N},

where S is the total number of species observed and N is the total number of counts.

This index is appropriate only for raw counts, not transformed counts or proportions.

Equivalent to margalef() in skbio.diversity.alpha.

Value

The value of Margalef's index, D ≥q 0. This index is undefined when the total number of counts is 1 or 0, in which case we return NaN.

References

Margalef R. Information theory in ecology. General Systems 3. 1958;36-71.

Examples

x <- c(15, 6, 4, 0, 3, 0)
margalef(x)

abdiv

Alpha and Beta Diversity Measures

v0.2.0
MIT + file LICENSE
Authors
Kyle Bittinger [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.