siteBySpecies: Generate site-by-species matrix

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Returns a site-by-species matrix of abundance or presence/absence values from a phylo4com object.

Usage

1
  siteBySpecies(phy, presence.only=FALSE, na.zero=FALSE, transpose=FALSE)

Arguments

phy

a phylo4com object

presence.only

logical. Should abundance values be replaced with 1/0 indicators of presence/absence?

na.zero

logical. should NAs be treated as zero abundances?

transpose

logical. Should matrix be transposed to put species in rows and sites in columns?

Details

If na.zero is false (the default), any NA values in the abundance data will be preserved in the matrix. However, abundance is assumed to be 0 for all species absent from the subtree for a given site.

If presence.only is true, the matrix will contain 1 for species with positive abundances in the corresponding tree, and 0 both for species with non-positive abundances and for species absent from the tree for a given site. As with abundance, if na.zero is false, NA values in the abundance data will remain as NA in the matrix.

In the default orientation, species will be in columns and sites in rows. To swap rows and columns, use transpose=TRUE (or manually transpose the returned object).

Value

Numeric matrix

Author(s)

Jim Regetz (regetz@nceas.ucsb.edu)

See Also

This function is just a convenience wrapper for the abundance and presence functions.

Examples

1
2
3
4
5
6
7
  data(weeds)
  siteBySpecies(weeds)
  siteBySpecies(weeds, presence.only=TRUE)

  ## change an abundance value to NA
  abundance(weeds, "A", 1) <- NA
  siteBySpecies(weeds, presence.only=TRUE, transpose=TRUE)

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