rmDesc: Remove nodes which are the descendants of other nodes

Description Usage Arguments Value Author(s) Examples

Description

rmDesc removes branches, which are the subbranches of the others.

Usage

1
rmDesc(tree, node, use.alias = FALSE)

Arguments

tree

A phylo object.

node

A vector of node labels or node numbers

use.alias

A logical value, TRUE or FALSE. The default is FALSE, and the node label would be used to name the output; otherwise, the alias of node label would be used to name the output. The alias of node label is created by adding a prefix "Node_" to the node number if the node is an internal node or adding a prefix "Leaf_" if the node is a leaf node.

Value

A vector of nodes. The numeric value is the node number, and the vector name is the corresponding node label. If a node has no label, it would have NA as name when use.alias = FALSE, and have the alias of node label as name when use.alias = TRUE.

Author(s)

Ruizhu Huang

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
data(tinyTree)
library(ggtree)
# PLOT
ggtree(tinyTree, branch.length = 'none') +
 geom_text2(aes(label = label), color = "darkorange",
           hjust = -0.1, vjust = -0.7) +
 geom_text2(aes(label = node), color = "darkblue",
               hjust = -0.5, vjust = 0.7)


# find the shared nodes from the tree plot
aV <- c(5, 4, 18, 3, 2)
# final result
(rn <- rmDesc(tree = tinyTree, node = aV))
}

markrobinsonuzh/treeAGG documentation built on May 26, 2019, 9:32 a.m.