relativeCDM: Convert absolute abundance matrix to relative abundance

Description Usage Arguments Details Value References Examples

View source: R/relativeCDM.R

Description

Simple utility function to convert an absolute abundance matrix to a relative abundance matrix.

Usage

1
relativeCDM(picante.cdm, tree = NULL)

Arguments

picante.cdm

Picante-style community data matrix with communities/plots/plots/etc as rows and species as columns

tree

Optional phylo object

Details

This function converts species' absolute abundances in a given community (a row in the input CDM) into relative abundances by dividing observed abundances by the maximum abundance in that row. If a tree is provided, the function confirms that the CDM is indeed in the correct format, otherwise it assumes it is formatted correctly and proceeds accordingly.

Value

A relative abundance matrix otherwise identical to the input CDM.

References

Miller, E. T., D. R. Farine, and C. H. Trisos. 2016. Phylogenetic community structure metrics and null models: a review with new methods and software. Ecography DOI: 10.1111/ecog.02070

Examples

1
2
3
4
5
6
#simulate tree with birth-death process
tree <- geiger::sim.bdtree(b=0.1, d=0, stop="taxa", n=50)

sim.abundances <- round(rlnorm(5000, meanlog=2, sdlog=1)) + 1

cdm <- simulateComm(tree, richness.vector=10:25, abundances=sim.abundances)

eliotmiller/metricTester documentation built on Dec. 16, 2019, 12:39 p.m.