This function iteratively removes specified tips (or tips matching a pattern) from a phylogenetic tree without collapsing internal nodes or singleton nodes.
drop_tips_update(tr, drop_name, pattern = NULL)
A phylo
object with specified tips removed.
if (requireNamespace("ape")) {
library(ape)
tr <- rtree(10)
plot(tr)
# Drop tips containing "t1" or "t2" in their label
tr2 <- drop_tips_update(tr, pattern = "t1|t2")
plot(tr2)
# Alternatively, specify tips directly
tr3 <- drop_tips_update(tr, drop_name = c("t3", "t5"))
plot(tr3)
}
#> Loading required namespace: ape