diff --git a/R/treeManipulation.R b/R/treeManipulation.R index 7dd7e8bf..d4dba4de 100644 --- a/R/treeManipulation.R +++ b/R/treeManipulation.R @@ -864,16 +864,16 @@ relabel <- function(x, ref) { } -#checkLabels <- function(tree, tip) { -# ind <- match(tree$tip.label, tip) -# if (any(is.na(ind)) | length(tree$tip.label) != length(tip)) { -# stop("tree has different labels") -# } -# tree$tip.label <- tip -# ind2 <- tree$edge[, 2] <= Ntip(tree) -# tree$edge[ind2, 2] <- ind[tree$edge[ind2, 2]] -# tree -#} +checkLabels <- function(tree, tip) { + ind <- match(tree$tip.label, tip) + if (any(is.na(ind)) | length(tree$tip.label) != length(tip)) { + stop("tree has different labels") + } + tree$tip.label <- tip + ind2 <- tree$edge[, 2] <= Ntip(tree) + tree$edge[ind2, 2] <- ind[tree$edge[ind2, 2]] + tree +}