- new.trms <- !(phy$edge[, 2] %in% phy$edge[, 1]) & phy$edge[, 2] > Ntip
- node2tip <- phy$edge[new.trms, 2]
- if (subtree)
- new.lab <- paste("[", N[node2tip], "_tips]", sep = "")
- else {
- new.lab <-
- if (is.null(phy$node.label)) rep("NA", length(node2tip))
- else phy$node.label[node2tip - Ntip]
+ ## get the logical indices of the tips that are kept within 'oldNo.ofNewTips':
+ tips.kept <- oldNo.ofNewTips <= Ntip & !(oldNo.ofNewTips %in% tip)
+ new.tip.label <- character(n)
+ new.tip.label[tips.kept] <- phy$tip.label[-tip]
+ ## get the numbers of the nodes that become tips:
+ node2tip <- oldNo.ofNewTips[!tips.kept]
+ new.tip.label[!tips.kept] <- if (subtree) {
+ paste("[", N[node2tip], "_tips]", sep = "")
+ } else {
+ if (is.null(phy$node.label)) rep("NA", length(node2tip))
+ else phy$node.label[node2tip - Ntip]