Learn R Programming

metricTester (version 1.3.6)

phyloField: Calculate a species' phylogenetic field

Description

Calculate the phylogenetic relatedness of a species to those it occurs with.

Usage

phyloField(tree, picante.cdm, metric)

Arguments

tree

Phylo object. Will be pruned to species actually in the cdm.

picante.cdm

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

metric

Phylogenetic metric of choice (see details)

Value

Named vector of species' phylogenetic fields.

Details

This function is being deprecated. This and the rest of the first generation of field functions are being replaced by a two-step process akin to the calcMetrics set of functions. The user first preps the data with a prep function, then runs the desired metrics and nulls over the prepped object. This allows sets of metrics to be calculated over the same randomized matrix, rather than having to repeatedly generate the same random matrix for each metric. Currently this is only programmed to use either non-abundance-weighted mean pairwise or interspecific abundance-weighted mean pairwise phylogenetic distance. Importantly, we are in the process of generalizing the phylo & trait field functions, so they operate more like the calcMetrics functions. In other words, the user will prep their data first, then choose which metrics to calculate and the function will detect whether to calculate phylo or trait fields based on the inputs. Take note of this, as code using the current forms of these functions is liable to break when these updates are made.

References

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

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)

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

#simulate a community data matrix with these inputs
cdm <- simulateComm(tree, richness.vector=10:25, abundances=sim.abundances)

#example phylogenetic field calculations
exampleField <- phyloField(tree=tree, picante.cdm=cdm, metric="naw.mpd")
# }

Run the code above in your browser using DataLab