From e5999e48c6a32fb35211f76d0776f785991192cf Mon Sep 17 00:00:00 2001 From: Klaus Schliep Date: Fri, 25 Oct 2024 17:13:03 +0200 Subject: [PATCH] bug fix --- R/phyDat.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/R/phyDat.R b/R/phyDat.R index b794cbca..156a2243 100644 --- a/R/phyDat.R +++ b/R/phyDat.R @@ -167,6 +167,7 @@ rbind.phyDat <- function(...){ x <- list(...) types <- sapply(x, function(x)attr(x, "type")) l <- sapply(x, function(x)sum(attr(x, "weight"))) + has_gaps <- all(sapply(x, has_gap_state)) if(any(l!=l[1]))stop("Alignments have different # of characters!") if(any(types!=types[1]))stop("Alignments must have same type!") nam <- lapply(x, names) |> unlist() @@ -183,7 +184,9 @@ rbind.phyDat <- function(...){ attr(x[[1]], "levels")) return(phyDat(res, type="USER", contrast=contrast)) } - phyDat(res, type=types[1]) + result <- phyDat(res, type=types[1]) + if(has_gaps) result <- gap_as_state(result) + result }