treedataMatch: Cross-reference tree and data

treedataMatchR Documentation

Cross-reference tree and data

Description

The function matches data names with tree tips. If either there is no data for a tip or it is not present on the tree, the function removes the entry from both.

Usage

treedataMatch(tree,y)

Arguments

tree

a phylogenetic tree. The tree needs not to be ultrametric and fully dichotomous.

y

either a single vector variable or a multivariate dataset. In any case, y must be named.

Value

The function returns a list object. If no mismatch between tree and y is detected, the list only includes the matrix of y ordered according to the order of tips on the tree ($y). If some tips on the tree are missing from y, they are removed from the phylogeny. Thus, the list also includes the pruned tree ($tree) and the vector of dropped tips ($removed.from.tree). Similarly, if some entries in y are missing from the tree, the list also includes the vector of mismatching entry names ($removed.from.y). In this latter case, the first element of the list ($y) does not include the entries $removed.from.y, so that it perfectly matches the phylogeny.

Author(s)

Silvia Castiglione, Pasquale Raia, Carmela Serio

Examples

data(DataCetaceans)
DataCetaceans$treecet->treecet
DataCetaceans$masscet->masscet
DataCetaceans$brainmasscet->brainmasscet

treedataMatch(tree=treecet,y=masscet)
treedataMatch(tree=treecet,y=brainmasscet)

RRphylo documentation built on June 7, 2023, 5:49 p.m.