| drop_tips_update | R Documentation |
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)
tr |
A phylogenetic tree of class |
drop_name |
A character vector of tip or node names to drop.
If missing and |
pattern |
An optional regular expression pattern to match tip or node labels for dropping. |
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.