View source: R/tips_from_node.r
tips_from_node | R Documentation |
Determines which tip indices in a phylogeny descend from a given node. Called by make_nested_set(), not intended for use otherwise, but some may find it handy. Data should come from a rooted phylogeny, but this function doesn't check that so be careful.
tips_from_node(nodes, anc, des)
nodes |
integer vector or scalar. The node index or indices for which tip indices are desired. |
anc |
integer vector. "ancestor" column vector from an adjacency matrix. For an ape::phylo object phy, anc=phy$edge[,1]. |
des |
integer vector. "descendant" column vector from an adjacency matrix. For an ape::phylo object phy, des=phy$edge[,2]. |
integer vector of tip indices, in no particular order.
John L. Darcy
ape::phylo
# library(specificity)
# library(ape)
# phy <- get(data(endophyte))$supertree
# # check if tree is rooted:
# ape::is.rooted(phy)
# # which tips are in the Cucurbitales?
# plot(phy) # need to stretch out the plot to see...
# nodelabels(adj=c(0,-1), bg="yellow") # node numbers
# nodelabels(phy$node.label, adj=c(0,1), bg="lightblue") # node names
# # we can see that Cucurbitales is node 107
# cuc_tips <- tips_from_node( nodes=107, anc=phy$edge[,1], des=phy$edge[,2] )
# cuc_tips
# phy$tip.label[cuc_tips]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.