Learn R Programming

TreeTools (version 1.12.0)

KeptPaths: Paths present in reduced tree

Description

Lists which paths present in a master tree are present when leaves are dropped.

Usage

KeptPaths(paths, keptVerts, all = TRUE)

# S3 method for data.frame KeptPaths(paths, keptVerts, all = TRUE)

# S3 method for matrix KeptPaths(paths, keptVerts, all = TRUE)

Value

KeptPaths() returns a logical vector specifying whether each path in paths occurs when keptVerts vertices are retained.

Arguments

paths

data.frame of paths in master tree, perhaps generated using PathLengths().

keptVerts

Logical specifying whether each entry is retained in the reduced tree, perhaps generated using KeptVerts().

all

Logical: if TRUE, return all paths that occur in the reduced tree; if FALSE, return only those paths that correspond to a single edge. that correspond to edges in the reduced tree. Ignored if paths is a matrix.

See Also

Other tree manipulation: AddTip(), CollapseNode(), ConsensusWithout(), DropTip(), EnforceOutgroup(), ImposeConstraint(), KeptVerts(), LeafLabelInterchange(), MakeTreeBinary(), Renumber(), RenumberTips(), RenumberTree(), RootTree(), SortTree(), Subtree(), TipTimedTree(), TrivialTree

Examples

Run this code
master <- BalancedTree(9)
paths <- PathLengths(master)
keptTips <- c(1, 5, 7, 9)
keptVerts <- KeptVerts(master, keptTips)
KeptPaths(paths, keptVerts)
paths[KeptPaths(paths, keptVerts, all = FALSE), ]

Run the code above in your browser using DataLab