match.tip.edge: Match tips edge vector

View source: R/match.tip.edge.R

match.tip.edgeR Documentation

Match tips edge vector

Description

Match a vector of tips with the an edge list

Usage

match.tip.edge(vector, phylo, replace.na)

Arguments

vector

a vector of variables (equal to the number of tips).

phylo

a phylo object.

replace.na

optional, what to replace NAs with.

Value

A vector of variables equal to the number of edges in the tree

Author(s)

Thomas Guillerme

Examples

## A random tree
tree <- rtree(20)

## A random vector of two variables for each tips
tip_values <- sample(c("blue", "red"), 20, replace = TRUE)

## Matching the colors (blue and red) to the tips descendants
edge_colors <- match.tip.edge(tip_values, tree, replace.na = "grey")

## Plotting the results
plot(tree, show.tip.label = FALSE, edge.color = edge_colors)
tiplabels(1:20, bg = tip_values)



dispRity documentation built on Aug. 9, 2022, 5:11 p.m.