Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausVigo committed Jun 17, 2024
1 parent 971d981 commit 17ce4c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/ancestral.R
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,11 @@ ancestral <- function(tree, align, prob){
stopifnot(inherits(tree, "phylo"))
stopifnot(inherits(align, "phyDat"))
stopifnot(inherits(prob, "data.frame"))
if(is.null(tree$node.label))stop("tree needs node.label")
state <- extract_states(prob, attr(align, "type"),
levels=attr(align, "levels"))
erg <- list(tree=tree, data=align, prob=prob, state=state)
erg <- list(tree=tree, data=align[tree$tip.label], prob=prob,
state=state[tree$node.label])
class(erg) <- "ancestral"
erg
}
Expand Down

0 comments on commit 17ce4c1

Please sign in to comment.