5 bind.tree(x, y, where = "root", position = 0)
8 \item{x}{an object of class \code{"phylo"}.}
9 \item{y}{an object of class \code{"phylo"}.}
10 \item{where}{an) integer giving the number of the node or tip of the
11 tree \code{x} where the tree \code{y} is binded (\code{"root"} is a
12 short-cut for the root).}
13 \item{position}{a numeric value giving the position from the tip or
14 node given by \code{node} where the tree \code{y} is binded;
15 negative values are ignored.}
18 This function binds together two phylogenetic trees to give a single
19 object of class \code{"phylo"}.
22 The argument \code{x} can be seen as the receptor tree, whereas
23 \code{y} is the donor tree. The root of \code{y} is then sticked on a
24 location of \code{x} specified by \code{where} and, possibly,
25 \code{position}. If \code{y} has a root edge, this is added as in
26 internal branch in the resulting tree.
29 an object of class \code{"phylo"}.
32 For the moment, this function handles only trees with branch lengths,
33 and does not handle node labels.
35 Further testing/improvements may be needed.
37 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
39 \code{\link{drop.tip}}, \code{\link{root}}
42 ### binds the two clades of bird orders
43 cat("((Struthioniformes:21.8,Tinamiformes:21.8):4.1,",
44 "((Craciformes:21.6,Galliformes:21.6):1.3,Anseriformes:22.9):3.0):2.1;",
45 file = "ex1.tre", sep = "\n")
46 cat("(Turniciformes:27.0,(Piciformes:26.3,((Galbuliformes:24.4,",
47 "((Bucerotiformes:20.8,Upupiformes:20.8):2.6,",
48 "(Trogoniformes:22.1,Coraciiformes:22.1):1.3):1.0):0.6,",
49 "(Coliiformes:24.5,(Cuculiformes:23.7,(Psittaciformes:23.1,",
50 "(((Apodiformes:21.3,Trochiliformes:21.3):0.6,",
51 "(Musophagiformes:20.4,Strigiformes:20.4):1.5):0.6,",
52 "((Columbiformes:20.8,(Gruiformes:20.1,Ciconiiformes:20.1):0.7):0.8,",
53 "Passeriformes:21.6):0.9):0.6):0.6):0.8):0.5):1.3):0.7):1.0;",
54 file = "ex2.tre", sep = "\n")
55 tree.bird1 <- read.tree("ex1.tre")
56 tree.bird2 <- read.tree("ex2.tre")
57 unlink(c("ex1.tre", "ex2.tre")) # clean-up
58 birds <- bind.tree(tree.bird1, tree.bird2, where = "root",
59 position = tree.bird1$root.edge)
61 layout(matrix(c(1, 2, 3, 3), 2, 2))