printNode: To print out the node labels

Description Usage Arguments Value Author(s) Examples

View source: R/tree_printNode.R

Description

nodeLabel is to print out the node labels of a phylo tree.

Usage

1
printNode(tree, type = c("leaf", "internal", "all"))

Arguments

tree

A phylo object.

type

A character value choose from leaf, all, and internal. If leaf, the output is a data frame including only leaf nodes; if internal, the output is a data frame including only internal nodes; if all, the output is a data frame including all nodes.

Value

a data frame

Author(s)

Ruizhu HUANG

Examples

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

# PLOT tree
# The node labels are in orange texts and the node numbers are in blue
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)

(pn1 <- printNode(tinyTree, type = "leaf"))
(pn2 <- printNode(tinyTree, type = "internal"))
(pn3 <- printNode(tinyTree, type = "all"))

fionarhuang/TreeSummarizedExperiment documentation built on June 16, 2021, 2:11 p.m.