Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

data.checking

Match taxa in phylogeny and data


Description

These functions compare taxa present in phylogenies with community or trait data sets, pruning and sorting the two kinds of data to match one another for subsequent analysis.

Usage

match.phylo.comm(phy, comm)
match.phylo.data(phy, data)
match.comm.dist(comm, dis)

Arguments

phy

A phylogeny object of class phylo

comm

Community data matrix

data

A data object - a vector (with names matching phy) or a data.frame or matrix (with row names matching phy)

dis

A distance matrix - a dist or matrix object

Details

A common pitfall in comparative analyses in R is that taxa labels are assumed to match between phylogenetic and other data sets. These functions prune a phylogeny and community or trait data set to match one another, reporting taxa that are missing from one data set or the other.

Taxa names for phylogeny objects are taken from the phylogeny's tip labels. Taxa names for community data are taken from the column names. Taxa names for trait data are taken from the element names (vector) or row names (data.frame or matrix). Taxa names for distance data are taken from column/row names of the distance matrix/dist object.

If community data lack taxa names, the function will issue a warning and no result will be returned, since the community-phylogenetic analyses in picante require named taxa in the community data set.

If trait data or distance matrix lack names, a warning is issued and the data are assumed to be sorted in the same order as the phylogeny's tip labels or community's column labels.

These utility functions are used by several functions that assume taxa labels in phylogeny and data match, including Kcalc, phylosignal, and raoD.

Value

A list containing the following elements, pruned and sorted to match one another:

phy

A phylogeny object of class phylo

comm

Community data matrix

data

A data object (vector, data.frame or matrix)

dist

A distance matrix - a dist or matrix object

Author(s)

Steven Kembel <steve.kembel@gmail.com>

See Also

Examples

data(phylocom)
match.phylo.comm(phylocom$phylo, phylocom$sample)
match.phylo.data(phylocom$phylo, phylocom$traits[1:10,])

picante

Integrating Phylogenies and Ecology

v1.8.2
GPL-2
Authors
Steven W. Kembel <steve.kembel@gmail.com>, David D. Ackerly <dackerly@berkeley.edu>, Simon P. Blomberg <s.blomberg1@uq.edu.au>, Will K. Cornwell <cornwell@zoology.ubc.ca>, Peter D. Cowan <pdc@berkeley.edu>, Matthew R. Helmus <mrhelmus@wisc.edu>, Helene Morlon <morlon.helene@gmail.com>, Campbell O. Webb <cwebb@oeb.harvard.edu>
Initial release
2020-06-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.