simulateComm: Generate a simulated community data matrix

Description Usage Arguments Details Value References Examples

View source: R/simulateComm.R

Description

Given a phylo object, a vector of desired species richnesses, and a vector of potential species abundances, will generate a community data matrix with these characteristics.

Usage

1
simulateComm(tree, richness.vector, abundances)

Arguments

tree

Phylo object

richness.vector

Vector of desired species richness, one for each desired plot

abundances

A vector of potential abundances, e.g. a log-normal distribution

Details

There is currently no implementation to control the frequency with which a given species is selected. As of metricTester 1.2.2, this function no longer can occasionally return a CDM missing species that are in the input phylogeny.

Value

A community data matrix (as a data frame) with species as columns and sites as rows.

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)

Example output

Loading required package: ape

metricTester documentation built on Dec. 16, 2019, 1:20 a.m.