prepFieldData: Prep data to to calculate phylogenetic fields

Description Usage Arguments Details Value References Examples

View source: R/prepFieldData.R

Description

Given a phylo object, and a picante-style community data matrix (sites are rows, species are columns), prepare data for calculation of phylogenetic or trait fields.

Usage

1
prepFieldData(tree, dists, picante.cdm)

Arguments

tree

Phylo object.

dists

A symmetric distance matrix can be directly supplied. By doing this, the user is implying that trait fields should be calculated.

picante.cdm

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

Details

Returns a named list with four elements: the original phylogenetic tree phylogenetic distances among species, the original picante-style CDM, and an argument, specifying whether the phylogenetic or trait field should be calculated. This is determined by the inputs. If a tree is supplied, the phylogenetic fields will be calculated. If a distance matrix is supplied, the trait fields will be calculated. Importantly, note that some metrics require a tree for calculation. These metrics include PSV, PSC, PD, and QE. If a trait distance matrix is supplied, and these metrics are called, the distances will be automatically coerced into a dendrogram via the hclust function and conversion to an ape phylogeny.

Value

An object of class field.input

References

Miller, Wagner, Harmon & Ricklefs. In review. Radiating despite a lack of character: closely related, morphologically similar, co-occurring honeyeaters have diverged ecologically.

Examples

1
2
3
4
5
6
7
8
#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)

prepped <- prepFieldData(tree=tree, picante.cdm=cdm)

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