observedMetrics: Wrapper for prepping and calculating observed metrics

Description Usage Arguments Details Value References Examples

View source: R/observedMetrics.R

Description

Given a cdm and phylogeny, this function preps the data and calculates metrics of the user's choice

Usage

1
observedMetrics(tree, picante.cdm, metrics)

Arguments

tree

Phylo object

picante.cdm

A picante-style community data matrix with sites as rows, and species as columns

metrics

Optional. If not provided, defines the metrics as all of those in defineMetrics. If only a subset of those is desired, then metrics should take the form of a character vector corresponding to named functions from defineMetrics. The available metrics can be determined by running names(defineMetrics()). Otherwise, if the user would like to define a new metric on the fly, the argument can take the form of a named list of new functions (metrics).

Details

A simple wrapper function to quickly prep data and calculate observed metrics.

Value

A data frame with the species richness and calculated phylogenetic community structure metrics for all input plots from the 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
 7
 8
 9
10
11
12
13
14
15
16
17
18
tree <- geiger::sim.bdtree(b=0.1, d=0, stop="taxa", n=50)

#prep the data for the simulation
prepped <- prepSimulations(tree, arena.length=300, mean.log.individuals=2, 
	length.parameter=5000, sd.parameter=50, max.distance=20, proportion.killed=0.2,
	competition.iterations=3)

positions <- randomArena(prepped)

tempCDM <- makeCDM(positions, 15, 30)

results <- observedMetrics(tree=tree, picante.cdm=tempCDM$picante.cdm)

#example of how to pass specific metrics to be calculated (always use at least 
#richness). not run

#results <- observedMetrics(tree=tree, picante.cdm=tempCDM$picante.cdm, 
#metrics=c("richness","PSV"))

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