3 \title{Remove Tips in a Phylogenetic Tree}
5 drop.tip(phy, tip, trim.internal = TRUE, subtree = FALSE,
9 \item{phy}{an object of class \code{"phylo"}.}
10 \item{tip}{a vector of mode numeric or character specifying the tips
12 \item{trim.internal}{a logical specifying whether to delete the
13 corresponding internal branches.}
14 \item{subtree}{a logical specifying whether to output in the tree how
15 many tips have been deleted and where.}
16 \item{root.edge}{an integer giving the number of internal branches to
17 be used to build the new root edge. This has no effect if
18 \code{trim.internal = FALSE}.}
21 This function removes the terminal branches of a phylogenetic tree,
22 possibly removing the corresponding internal branches.
25 The argument \code{tip} can be either character or numeric. In the
26 first case, it gives the labels of the tips to be deleted; in the
27 second case the numbers of these labels in the vector
28 \code{phy$tip.label} are given.
30 If \code{trim.internal = FALSE}, the new tips are given \code{"NA"} as
31 labels, unless there are node labels in the tree in which case they
34 If \code{subtree = TRUE}, the returned tree has one or several
35 terminal branches indicating how many tips have been removed (with a
36 label \code{"[x_tips]"}). This is done for as many monophyletic groups
37 that have been deleted.
39 Note that \code{subtree = TRUE} implies \code{trim.internal = TRUE}.
41 To undestand how the option \code{root.edge} works, see the examples
45 an object of class \code{"phylo"}.
47 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
49 \code{\link{bind.tree}}, \code{\link{root}}
54 "Eopsaltriidae", "Acanthisittidae", "Pittidae", "Eurylaimidae",
55 "Philepittidae", "Tyrannidae", "Thamnophilidae", "Furnariidae",
56 "Formicariidae", "Conopophagidae", "Rhinocryptidae", "Climacteridae",
57 "Menuridae", "Ptilonorhynchidae", "Maluridae", "Meliphagidae",
58 "Pardalotidae", "Petroicidae", "Irenidae", "Orthonychidae",
59 "Pomatostomidae", "Laniidae", "Vireonidae", "Corvidae",
60 "Callaeatidae", "Picathartidae", "Bombycillidae", "Cinclidae",
61 "Muscicapidae", "Sturnidae", "Sittidae", "Certhiidae",
62 "Paridae", "Aegithalidae", "Hirundinidae", "Regulidae",
63 "Pycnonotidae", "Hypocoliidae", "Cisticolidae", "Zosteropidae",
64 "Sylviidae", "Alaudidae", "Nectariniidae", "Melanocharitidae",
65 "Paramythiidae","Passeridae", "Fringillidae")
66 plot(drop.tip(bird.families, tip))
67 plot(drop.tip(bird.families, tip, trim.internal = FALSE))
69 plot(drop.tip(bird.orders, 6:23, subtree = TRUE), font = 1)
70 plot(drop.tip(bird.orders, c(1:5, 20:23), subtree = TRUE), font = 1)
72 ### Examples of the use of `root.edge'
73 tr <- read.tree(text = "(A:1,(B:1,(C:1,(D:1,E:1):1):1):1):1;")
74 drop.tip(tr, c("A", "B"), root.edge = 0) # = (C:1,(D:1,E:1):1);
75 drop.tip(tr, c("A", "B"), root.edge = 1) # = (C:1,(D:1,E:1):1):1;
76 drop.tip(tr, c("A", "B"), root.edge = 2) # = (C:1,(D:1,E:1):1):2;
77 drop.tip(tr, c("A", "B"), root.edge = 3) # = (C:1,(D:1,E:1):1):3;