X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=R%2Froot.R;h=5655873a75398cdc16d8e84de39a53904ebc2e45;hb=dff741171e7afe3f9aaa2d9cb19c2f91995e8623;hp=c51184dc3645d6014c497febf91d00fa07a88cac;hpb=21426f51c5940cb37f3198a7853ef59743729b85;p=ape.git diff --git a/R/root.R b/R/root.R index c51184d..5655873 100644 --- a/R/root.R +++ b/R/root.R @@ -151,8 +151,8 @@ root <- function(phy, outgroup, node = NULL, 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) @@ -314,8 +314,7 @@ root <- function(phy, outgroup, node = NULL, 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)) {