Skip to content

Commit

Permalink
fix bug reported by @amizeranschi
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausVigo committed Jan 25, 2024
1 parent ebd9d80 commit 2f66600
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions R/phylo.R
Original file line number Diff line number Diff line change
Expand Up @@ -700,23 +700,23 @@ optEdgeMulti <- function(object, control = pml.control(epsilon = 1e-8,


# add data for internal use parent.frame(n) for higher nestings
update.pmlNew <- function(object, ..., evaluate = TRUE) {
call <- object$call
if (is.null(call))
stop("need an object with call component")
extras <- match.call(expand.dots = FALSE)$...
if (length(extras)) {
existing <- !is.na(match(names(extras), names(call)))
for (a in names(extras)[existing]) call[[a]] <- extras[[a]]
if (any(!existing)) {
call <- c(as.list(call), extras[!existing])
call <- as.call(call)
}
}
if (evaluate)
eval(call, object, parent.frame())
else call
}
# update.pmlNew <- function(object, ..., evaluate = TRUE) {
# call <- object$call
# if (is.null(call))
# stop("need an object with call component")
# extras <- match.call(expand.dots = FALSE)$...
# if (length(extras)) {
# existing <- !is.na(match(names(extras), names(call)))
# for (a in names(extras)[existing]) call[[a]] <- extras[[a]]
# if (any(!existing)) {
# call <- c(as.list(call), extras[!existing])
# call <- as.call(call)
# }
# }
# if (evaluate)
# eval(call, object, parent.frame())
# else call
# }


#' @export
Expand Down Expand Up @@ -2064,6 +2064,8 @@ optim.pml <- function(object, optNni = FALSE, optBf = FALSE, optQ = FALSE,
orig.data <- data
addTaxa <- TRUE
tree <- drop.tip(tree, mapping[, 1])
if(method=="unrooted") tree <- unroot(tree)
attr(tree, "order") <- NULL
tree <- reorder(tree, "postorder")
}
}
Expand Down

0 comments on commit 2f66600

Please sign in to comment.