PCMBase (version 1.2.10)

PCMTreeMatchLabels: Get the node numbers associated with tip- or node-labels in a tree

Description

Get the node numbers associated with tip- or node-labels in a tree

Usage

PCMTreeMatchLabels(tree, labels, stopIfNotFound = TRUE)

Arguments

tree

a phylo object

labels

a character vector with valid tip or node labels from tree

stopIfNotFound

logical indicating if an error should be raised in case a label has not been found in the tree labels. Default: TRUE

Value

an integer vector giving the tip- or node- integer indices corresponding to labels. If stopIfNotFound is set to FALSE, this vector may contain NAs for the labels that were not found.

Examples

Run this code
# NOT RUN {
set.seed(1, kind = "Mersenne-Twister", normal.kind = "Inversion")
PCMTreeMatchLabels(PCMTree(ape::rtree(20)), c("1", "15", "21", "39"))
PCMTreeMatchLabels(PCMTree(ape::rtree(20)), c("1", "45"), stopIfNotFound = FALSE)
# }

Run the code above in your browser using DataLab