n2: Calculate Hill's N2 diversity measure

Description Usage Arguments Value Author(s) Examples

Description

Hills N2 is a measure of species diversity, commonly referred to as "effective" diversity. If computed on the rows (samples) then the "effective" number of species in each row is returned, whereas, if computed on the columns (species) then the "effective" number of occurences of each species in the data set is returned.

Usage

1
2
3
4
n2(x, ...)

## Default S3 method:
n2(x, which = c("species", "sites"), ...)

Arguments

x

matrix or data frame of species data

which

character; compute N2 on the rows ("sites") or the columns ("species") of x

...

arguments passed to other methods

Value

A numeric vector of N2 values.

Author(s)

Gavin L. Simpson

Examples

1
2
3
4
5
data(swapdiat)
sppN2 <- n2(swapdiat, "species")
head(sppN2)
sampN2 <- n2(swapdiat, "sites")
head(sampN2)

Example output

Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.4-3
analogue version 0.17-0
   AC001A    AC002A    AC004A    AC013A    AC014A    AC014B 
 8.248589 12.128209 10.997128 46.072440  3.025195  9.190233 
     1.21     10.21        11    113.21    115.11     12.11 
15.501849 11.026197  6.702897 10.712509 11.370488 15.094376 

analogue documentation built on June 21, 2021, 1:08 a.m.