abundance: Get or set species abundances

Description Usage Arguments Details Value Author(s) Examples

Description

Functions to get or set the abundances of tip taxa in a phylogenetic tree.

Usage

1
2
3
  abundance(phy, comm, tip, na.zero=FALSE)
  presence(phy, comm, tip, na.zero=FALSE)
  abundance(phy, comm, tip) <- value

Arguments

phy

a phylo4com object

comm

a vector of community labels; if missing, all communities (not allowed in the replacement form)

tip

a vector of tip labels or numeric node IDs; if missing, all tips

na.zero

logical. should NAs be treated as zero abundances?

value

a numeric vector of abundance values

Details

Any missing abundances will be represented by NA, unless na.zero is true, in which case they will be treated as zero. This is also true of the corresponding presence/absence matrix.

The tip vector can either be character, in which case tip labels are matched, or integer, in which case the numeric node IDs of tips in the phylo4d tree will be matched. Users should not assume that these integer values will correspond to row positions in the tipData data frame, as this is an implementation detail that may change at any time.

In the assignment form, comm must be a single community label; it is not possible to update the abundances of multiple communities simultaneously. In contrast, tip can be a single value, multiple values, or missing (in which case all tip abundances will be replaced). If the value vector is shorter than the number of tips, normal R recycling rules will apply.

Value

For abundance and presence, a data frame. For abundance<-, the updated tree.

Author(s)

Jim Regetz (regetz@nceas.ucsb.edu)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  data(weeds)
  abundance(weeds)
  abundance(weeds, "A")

  ## abundance replacement
  abundance(weeds, "A", "Centaurea_alba") <- NA
  abundance(weeds, "B", 2:4) <- c(0, 100, 0)
  abundance(weeds, "C") <- 25

  presence(weeds, na.zero=TRUE)

eliotmiller/ecoPDcorr documentation built on May 16, 2019, 3:02 a.m.