Skip to content

Commit

Permalink
remove redundant_ifelse
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausVigo committed Nov 28, 2024
1 parent d10b44a commit 46cacf7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions R/bab.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ bab <- function(data, tree = NULL, trace = 1, ...) {
if (nTips < 4) return(stree(nTips, tip.label = names(data)))

data <- removeParsimonyUninfomativeSites(data, recursive=recursive)
star_tree <- ifelse(attr(data, "nr") == 0, TRUE, FALSE)
add_taxa <- ifelse(is.null(attr(data, "duplicated")), FALSE, TRUE)
star_tree <- attr(data, "nr") == 0
add_taxa <- !is.null(attr(data, "duplicated"))
p0 <- attr(data, "p0")

nTips <- length(data)
Expand Down
4 changes: 2 additions & 2 deletions R/fitch64.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ optim.fitch <- function(tree, data, trace = 1, rearrangements = "NNI", ...) {
# New
data <- removeParsimonyUninfomativeSites(data, recursive=TRUE)

star_tree <- ifelse(attr(data, "nr") == 0, TRUE, FALSE)
add_taxa <- ifelse(is.null(attr(data, "duplicated")), FALSE, TRUE)
star_tree <- attr(data, "nr") == 0
add_taxa <- !is.null(attr(data, "duplicated"))
nTips <- length(data)
if (nTips < 4L || star_tree) {
nam <- names(data)
Expand Down
4 changes: 2 additions & 2 deletions R/parsimony.R
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ pratchet <- function(data, start = NULL, method = "fitch", maxit = 1000,
if(!is.null(attr(data, "informative"))) w[attr(data, "informative")] <- TRUE
else w[] <- TRUE

star_tree <- ifelse(attr(data, "nr") == 0, TRUE, FALSE)
add_taxa <- ifelse(is.null(attr(data, "duplicated")), FALSE, TRUE)
star_tree <- attr(data, "nr") == 0
add_taxa <- !(is.null(attr(data, "duplicated")))
nTips <- length(data)
# check for trivial trees
if (nTips < (3L + !ROOTED) || star_tree) {
Expand Down
6 changes: 3 additions & 3 deletions R/phylo.R
Original file line number Diff line number Diff line change
Expand Up @@ -2067,9 +2067,9 @@ optim.pml <- function(object, optNni = FALSE, optBf = FALSE, optQ = FALSE,
aLRT <- FALSE
rearrangement <- match.arg(rearrangement,
c("none", "NNI", "ratchet", "stochastic", "multi2di"))
optNni <- ifelse(rearrangement == "none", FALSE, TRUE)
perturbation <- ifelse(rearrangement %in%
c("ratchet", "stochastic", "multi2di"), TRUE, FALSE)
optNni <- !(rearrangement == "none")
perturbation <- rearrangement %in%
c("ratchet", "stochastic", "multi2di")
if(rearrangement=="ratchet") fbs <- vector("list", ratchet.par$minit)
extras <- match.call(expand.dots = FALSE)$...
pmla <- c("wMix", "llMix")
Expand Down
4 changes: 2 additions & 2 deletions R/splits.R
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ postprocess.splits <- function (x)
x <- SHORTwise(x)
drop <- duplicated(x)
if (any(drop)) {
W <- ifelse (is.null(tmp$weights), FALSE, TRUE)
CONF <- ifelse (is.null(tmp$confidences), FALSE, TRUE)
W <- !(is.null(tmp$weights))
CONF <- !(is.null(tmp$confidences))
if(W) w <- tmp$weights
if (CONF) conf <- tmp$confidences
class(x) <- NULL
Expand Down

0 comments on commit 46cacf7

Please sign in to comment.