From d10b44aa861c84677700c02533ac4ec68954c054 Mon Sep 17 00:00:00 2001 From: Klaus Schliep Date: Thu, 28 Nov 2024 09:55:51 +0100 Subject: [PATCH] fix redundant ifelse (flint) --- R/distSeq.R | 2 +- R/plotBS.R | 4 ++-- R/read.nexus.splits.R | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/distSeq.R b/R/distSeq.R index de1c0cdf..79145a3a 100644 --- a/R/distSeq.R +++ b/R/distSeq.R @@ -379,7 +379,7 @@ read.nexus.dist <- function(file){ semico <- grep(";", X) X <- gsub("\\[(.*?)\\]", "", X) # get rid of comments i1 <- grep("TAXLABELS", X, ignore.case = TRUE) - taxlab <- ifelse(length(i1) > 0, TRUE, FALSE) + taxlab <- length(i1) > 0 if (taxlab) { end <- semico[semico >= i1][1] x <- X[(i1):end] # assumes not a 'new line' after "TRANSLATE" diff --git a/R/plotBS.R b/R/plotBS.R index 1d2ce7d7..5e5534fb 100644 --- a/R/plotBS.R +++ b/R/plotBS.R @@ -1,8 +1,8 @@ support <- function(tree, trees, method="FBP", tol=2e-8, scale=TRUE){ trees <- keep.tip(trees, tree$tip.label) method <- match.arg(method, c("FBP", "TBE", "MCC"), several.ok=TRUE) - multi <- ifelse(length(method)>1, TRUE, FALSE) - tip2root <- ifelse(method=="MCC", TRUE, FALSE) + multi <- length(method)>1 + tip2root <- method=="MCC" if(all(sapply(trees, \(x)!is.null(x$edge.length)))){ trees <- di2multi(trees, tol=tol) # , tip2root=tip2root) } diff --git a/R/read.nexus.splits.R b/R/read.nexus.splits.R index e0abc759..c90eb460 100644 --- a/R/read.nexus.splits.R +++ b/R/read.nexus.splits.R @@ -51,7 +51,7 @@ read.nexus.splits <- function(file) { sp <- grep("SPLITS;", X, ignore.case = TRUE) i1 <- i1[i1 < sp] if(length(i1)>1)i1 <- i1[length(i1)] - taxlab <- ifelse(length(i1) > 0, TRUE, FALSE) + taxlab <- length(i1) > 0 if (taxlab) { end <- semico[semico >= i1][1] x <- X[(i1):end] # assumes not a 'new line' after "TRANSLATE"