## find the tips to drop:
if (is.character(tip))
tip <- which(phy$tip.label %in% tip)
- trms <- edge2 <= Ntip
## delete the terminal edges given by `tip':
keep[match(tip, edge2)] <- FALSE
if (trim.internal) {
- ## delete the internal edges that do not have descendants
- ## anymore (ie, they are in the 2nd column of `edge' but
+ internals <- edge2 <= Ntip
+ ## delete the internal edges that do not have anymore
+ ## descendants (ie, they are in the 2nd col of `edge' but
## not in the 1st one)
repeat {
- sel <- !(edge2 %in% edge1[keep]) & !trms & keep
+ sel <- !(edge2 %in% edge1[keep]) & internals & keep
if (!sum(sel)) break
keep[sel] <- FALSE
}
if (subtree) {
## keep the subtending edge(s):
subt <- edge1 %in% edge1[keep] & edge1 %in% edge1[!keep]
- ## <FIXME> 'if (... ' needed below?
- if (any(subt)) keep[which(subt)] <- TRUE
+ keep[subt] <- TRUE
}
if (root.edge && wbl) {
degree <- tabulate(edge1[keep])