Learn R Programming

ape (version 5.8)

updateLabel: Update Labels

Description

This function changes labels (names or rownames) giving two vectors (old and new). It is a generic function with several methods as described below.

Usage

updateLabel(x, old, new, ...)
# S3 method for character
updateLabel(x, old, new, exact = TRUE, ...)
# S3 method for DNAbin
updateLabel(x, old, new, exact = TRUE, ...)
# S3 method for AAbin
updateLabel(x, old, new, exact = TRUE, ...)
# S3 method for phylo
updateLabel(x, old, new, exact = TRUE, nodes = FALSE, ...)
# S3 method for evonet
updateLabel(x, old, new, exact = TRUE, nodes = FALSE, ...)
# S3 method for data.frame
updateLabel(x, old, new, exact = TRUE, ...)
# S3 method for matrix
updateLabel(x, old, new, exact = TRUE, ...)

Value

an object of the same class than x.

Arguments

x

an object where to change the labels.

old, new

two vectors of mode character (must be of the same length).

exact

a logical value (see details).

nodes

a logical value specifying whether to also update the node labels of the tree or network.

...

further arguments passed to and from methods.

Author

Emmanuel Paradis

Details

This function can be used to change some of the labels (see examples) or all of them if their ordering is not sure.

If exact = TRUE (the default), the values in old are matched exactly with the labels; otherwise (exact = FALSE), the values in old are considered as regular expressions and searched in the labels with grep.

See Also

makeLabel, makeNodeLabel, mixedFontLabel, stripLabel, checkLabel