rename_taxa: rename_taxa

Description Usage Arguments Value Author(s) Examples

View source: R/rename.R

Description

rename tip label of phylogenetic tree

Usage

1
rename_taxa(tree, data, key = 1, value = 2)

Arguments

tree

tree object, either treedata or phylo

data

data frame

key

column in data that match tip label (use 1st column by default)

value

column in data for rename tip label (use 2nd column by default)

Value

tree object

Author(s)

Guangchuang Yu

Examples

1
2
3
4
tree <- rtree(3)
d <- data.frame(old = paste0('t', 1:3), new = LETTERS[1:3])
rename_taxa(tree, d)
rename_taxa(tree, d, old, new)

Example output

Registered S3 method overwritten by 'treeio':
  method     from
  root.phylo ape 
treeio v1.14.3  For help: https://yulab-smu.top/treedata-book/

If you use treeio in published research, please cite:

LG Wang, TTY Lam, S Xu, Z Dai, L Zhou, T Feng, P Guo, CW Dunn, BR Jones, T Bradley, H Zhu, Y Guan, Y Jiang, G Yu. treeio: an R package for phylogenetic tree input and output with richly annotated and associated data. Molecular Biology and Evolution 2020, 37(2):599-603. doi: 10.1093/molbev/msz240


Phylogenetic tree with 3 tips and 2 internal nodes.

Tip labels:
  A, C, B

Rooted; includes branch lengths.

Phylogenetic tree with 3 tips and 2 internal nodes.

Tip labels:
  A, C, B

Rooted; includes branch lengths.

treeio documentation built on Nov. 21, 2020, 2:01 a.m.