transNode: Transfer between node number and node label

Description Usage Arguments Value Author(s) Examples

Description

transNode does the transformation between the number and the label of a node on a tree

Usage

1
transNode(tree, input, use.alias = FALSE, message = FALSE)

Arguments

tree

A phylo object

input

A character or numeric vector representing tree node label(s) or tree node number(s)

use.alias

A logical value, TRUE or FALSE. This is an optional argument that only requried when return = "label". The default is FALSE, and the node label would be returned; otherwise, the alias of node label would be 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.

message

A logical value, TRUE or FALSE. The default is FALSE. If TRUE, message will show when a tree have duplicated labels for some internal nodes.

Value

a vector

Author(s)

Ruizhu Huang

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(ggtree)

data(tinyTree)

ggtree(tinyTree, branch.length = 'none') +
geom_text2(aes(label = label), hjust = -0.3) +
geom_text2(aes(label = node), vjust = -0.8,
hjust = -0.3, color = 'blue')

#check whether the node number and node label are matched
transNode(tinyTree, input = c(11, 2, 4, 15))

transNode(tree = tinyTree, input = c("Node_16", "Node_11"))

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