This function changes labels (names or rownames) giving two vectors (old
and new
). It is a generic function with several methods as described below.
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, ...)
an object of the same class than x
.
an object where to change the labels.
two vectors of mode character (must be of the same length).
a logical value (see details).
a logical value specifying whether to also update the node labels of the tree or network.
further arguments passed to and from methods.
Emmanuel Paradis
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
.
makeLabel
, makeNodeLabel
,
mixedFontLabel
, stripLabel
,
checkLabel