Calculates Shannon entropy from a vector of counts or abundances.

shannon_entropy(x)

Arguments

x

Numeric vector of counts or abundances.

Value

Shannon entropy.

Examples

shannon_entropy(c(10, 5, 1))
#> [1] 1.198192