
Last chance! 50% off unlimited learning
Sale ends in
Last chance! 50% off unlimited learning
Sale ends in
This function allows for a tree object to be subset by specifying a node and returns all related nodes within a selected number of levels
tree_subset(
tree,
node,
levels_back = 5,
group_node = TRUE,
group_name = "group",
root_edge = TRUE
)# S3 method for phylo
tree_subset(
tree,
node,
levels_back = 5,
group_node = TRUE,
group_name = "group",
root_edge = TRUE
)
# S3 method for treedata
tree_subset(
tree,
node,
levels_back = 5,
group_node = TRUE,
group_name = "group",
root_edge = TRUE
)
a tree object of class phylo
either a tip label or a node number for the given tree that will be the focus of the subsetted tree
a number specifying how many nodes back from the selected node the subsetted tree should include
whether add grouping information of selected node
group name (default 'group') for storing grouping information if group_node = TRUE
If TRUE (by default), set root.edge to path length of orginal root to the root of subset tree
This function will take a tree and a specified node from
that tree and subset the tree showing all relatives back to a specified
number of nodes. This function allows for a combination of
ancestor
and offspring
to return a subsetted
tree that is of class phylo. This allows for easy graphing of the tree
with ggtree
set.seed(123)
tree <- ape::rtree(6)
sub_tree <- tree_subset(tree, node = "t1", levels_back = 2)
Run the code above in your browser using DataLab