Learn R Programming

metricTester (version 1.3.6)

relativeCDM: Convert absolute abundance matrix to relative abundance

Description

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

Usage

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

Value

A relative abundance matrix otherwise identical to the input CDM.

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.

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

Run this code
# NOT RUN {
#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)
# }

Run the code above in your browser using DataLab