phy$edge <- rbind(phy$edge[a, ], c(ROOT, newnod),
phy$edge[b, ])
if (!is.null(phy$edge.length))
- phy$edge.length <-
- c(phy$edge.length[a], 0, phy$edge.length[b])
+ phy$edge.length <-
+ c(phy$edge.length[a], 0, phy$edge.length[b])
phy$Nnode <- phy$Nnode + 1L
## node renumbering (see comments below)
newNb <- integer(n + oldNnode)
newNb[newroot] <- n + 1L
sndcol <- phy$edge[, 2] > n
## executed from right to left, so newNb is modified before phy$edge:
- phy$edge[sndcol, 2] <- newNb[phy$edge[sndcol, 2]] <-
- (n + 2):(n + phy$Nnode)
+ phy$edge[sndcol, 2] <- newNb[phy$edge[sndcol, 2]] <- n + 2:phy$Nnode
phy$edge[, 1] <- newNb[phy$edge[, 1]]
if (!is.null(phy$node.label)) {