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