]> git.donarmstrong.com Git - ape.git/blob - man/makeLabel.Rd
new code from Pierre Legendre
[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 \usage{
9 makeLabel(x, ...)
10 \method{makeLabel}{character}(x, len = 99, space = "_", make.unique = TRUE,
11           illegal = "():;,[]", quote = FALSE, ...)
12 \method{makeLabel}{phylo}(x, tips = TRUE, nodes = TRUE, ...)
13 \method{makeLabel}{multiPhylo}(x, tips = TRUE, nodes = TRUE, ...)
14 \method{makeLabel}{DNAbin}(x, ...)
15 }
16 \arguments{
17   \item{x}{a vector of mode character or an object for which labels are
18     to be changed.}
19   \item{len}{the maximum length of the labels: those longer than `len'
20     will be truncated.}
21   \item{space}{the character to replace spaces, tabulations, and
22     linebreaks.}
23   \item{make.unique}{a logical specifying whether duplicate labels
24     should be made unique by appending numerals; \code{TRUE} by
25     default.}
26   \item{illegal}{a string specifying the characters to be deleted.}
27   \item{quote}{a logical specifying whether to quote the labels;
28     \code{FALSE} by default.}
29   \item{tips}{a logical specifying whether tip labels are to be
30     modified; \code{TRUE} by default.}
31   \item{nodes}{a logical specifying whether node labels are to be
32     modified; \code{TRUE} by default.}
33   \item{\dots}{further arguments to be passed to or from other methods.}
34 }
35 \description{
36   This is a generic function with methods for character vectors, trees
37   of class \code{"phylo"}, lists of trees of class \code{"multiPhylo"},
38   and DNA sequences of class \code{"DNAbin"}. All options for the class
39   character may be used in the 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 \email{Emmanuel.Paradis@mpl.ird.fr}}
61 \seealso{
62   \code{\link{makeNodeLabel}}, \code{\link[base]{make.unique}},
63   \code{\link[base]{make.names}}, code{\link[base]{abbreviate}}
64 }
65 \examples{
66 x <- rep("a", 3)
67 makeLabel(x)
68 make.unique(x) # <- from R's base
69 x <- rep("aaaaa", 2)
70 makeLabel(x, len = 3) # made unique and of length 3
71 makeLabel(x, len = 3, make.unique = FALSE)
72 }
73 \keyword{manip}