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

KeptPaths(paths, keptVerts, all = TRUE)

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

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

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.

Value

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

Author

Martin R. Smith (martin.smith@durham.ac.uk)

Examples

master <- BalancedTree(9)
paths <- PathLengths(master)
keptTips <- c(1, 5, 7, 9)
keptVerts <- KeptVerts(master, keptTips)
KeptPaths(paths, keptVerts)
#>  [1]  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [13] FALSE FALSE  TRUE  TRUE FALSE FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE
#> [25] FALSE FALSE  TRUE  TRUE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
#> [37] FALSE  TRUE FALSE FALSE FALSE FALSE
paths[KeptPaths(paths, keptVerts, all = FALSE), ]
#>    start end length
#> 2     11   1      3
#> 16    11   5      2
#> 22    15   7      2
#> 28    15   9      2
#> 30    10  11      1
#> 38    10  15      1