]> git.donarmstrong.com Git - ape.git/blob - man/makeLabel.Rd
new mixedFontLabel() + bug fix in rTraitCont.c
[ape.git] / man / makeLabel.Rd
1 \name{makeLabel}
2 \alias{makeLabel}
3 \alias{makeLabel.character}
4 \alias{makeLabel.phylo}
5 \alias{makeLabel.multiPhylo}
6 \alias{makeLabel.DNAbin}
7 \title{Label Management}
8 \description{
9   This is a generic function with methods for character vectors, trees
10   of class \code{"phylo"}, lists of trees of class \code{"multiPhylo"},
11   and DNA sequences of class \code{"DNAbin"}. All options for the class
12   character may be used in the other methods.
13 }
14 \usage{
15 makeLabel(x, ...)
16 \method{makeLabel}{character}(x, len = 99, space = "_", make.unique = TRUE,
17           illegal = "():;,[]", quote = FALSE, ...)
18 \method{makeLabel}{phylo}(x, tips = TRUE, nodes = TRUE, ...)
19 \method{makeLabel}{multiPhylo}(x, tips = TRUE, nodes = TRUE, ...)
20 \method{makeLabel}{DNAbin}(x, ...)
21 }
22 \arguments{
23   \item{x}{a vector of mode character or an object for which labels are
24     to be changed.}
25   \item{len}{the maximum length of the labels: those longer than `len'
26     will be truncated.}
27   \item{space}{the character to replace spaces, tabulations, and
28     linebreaks.}
29   \item{make.unique}{a logical specifying whether duplicate labels
30     should be made unique by appending numerals; \code{TRUE} by
31     default.}
32   \item{illegal}{a string specifying the characters to be deleted.}
33   \item{quote}{a logical specifying whether to quote the labels;
34     \code{FALSE} by default.}
35   \item{tips}{a logical specifying whether tip labels are to be
36     modified; \code{TRUE} by default.}
37   \item{nodes}{a logical specifying whether node labels are to be
38     modified; \code{TRUE} by default.}
39   \item{\dots}{further arguments to be passed to or from other methods.}
40 }
41 \details{
42   The option \code{make.unique} does not work exactly in the same way
43   then the function of the same name: numbers are suffixed to all labels
44   that are identical (without separator). See the examples.
45
46   If there are 10--99 identical labels, the labels returned are "xxx01",
47   "xxx02", etc, or "xxx001", "xxx002", etc, if they are 100--999, and so
48   on. The number of digits added preserves the option `len'.
49
50   The default for `len' makes labels short enough to be read by
51   PhyML. Clustal accepts labels up to 30 character long.
52 }
53 \note{
54   The current version does not perform well when trying to make very
55   short unique labels (e.g., less than 5 character long).
56 }
57 \value{
58   An object of the appropriate class.
59 }
60 \author{Emmanuel Paradis}
61 \seealso{
62   \code{\link{makeNodeLabel}}, \code{\link[base]{make.unique}},
63   \code{\link[base]{make.names}}, \code{\link[base]{abbreviate}},
64   \code{\link{mixedFontLabel}}
65 }
66 \examples{
67 x <- rep("a", 3)
68 makeLabel(x)
69 make.unique(x) # <- from R's base
70 x <- rep("aaaaa", 2)
71 makeLabel(x, len = 3) # made unique and of length 3
72 makeLabel(x, len = 3, make.unique = FALSE)
73 }
74 \keyword{manip}