richness: Calculate richness for each community

Description Usage Arguments Details Value Author(s) Examples

View source: R/utilities.R

Description

Returns the species richness of each community, i.e. the number of tip taxa having positive abundance.

Usage

1
  richness(phy, comm, na.zero = FALSE)

Arguments

phy

a phylo4com object

comm

a vector of community labels; if missing, all communities

na.zero

logical. should NAs be treated as zero abundances?

Details

For each community tree, the upper bound on richness is simply the number of tips in the tree. However, the richness value will be lower if any species do not have positive abundance. When na.zero=TRUE, species with NA abundance are considered missing, otherwise NA will propagate through to the result.

Value

Vector of richness values, with names corresponding to community names in the phylo4com object.

Author(s)

Jim Regetz (regetz@nceas.ucsb.edu)

Examples

1
2
3
4
5
6
7
8
  data(weeds)
  richness(weeds)

  abundance(weeds, "A", 4) <- 0
  richness(weeds)

  abundance(weeds, "B", 2:3) <- NA
  richness(weeds, na.zero=TRUE)

ecoPD documentation built on May 2, 2019, 5:22 p.m.