Learn R Programming

picante (version 1.8.2)

match.phylo.data: 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

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

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.

See Also

prune.missing, prune.sample

Examples

Run this code
# NOT RUN {
data(phylocom)
match.phylo.comm(phylocom$phylo, phylocom$sample)
match.phylo.data(phylocom$phylo, phylocom$traits[1:10,])
# }

Run the code above in your browser using DataLab