From b377c96f3ca98d0284b3e8ea717a655e7d71b5e5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 20 Jul 2024 18:42:10 +0200 Subject: [PATCH] lintr --- R/format_parameters.R | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/R/format_parameters.R b/R/format_parameters.R index dbbc5a19b..33c508e4f 100644 --- a/R/format_parameters.R +++ b/R/format_parameters.R @@ -72,10 +72,10 @@ format_parameters.parameters_model <- function(model, ...) { # save some time, if model info is passed as argument dot_args <- list(...) - if (!is.null(dot_args$model_info)) { - info <- dot_args$model_info - } else { + if (is.null(dot_args$model_info)) { info <- insight::model_info(model, verbose = FALSE) + } else { + info <- dot_args$model_info } ## TODO remove is.list() when insight 0.8.3 on CRAN @@ -299,16 +299,16 @@ format_parameters.parameters_model <- function(model, ...) { if (type == "interaction") { components <- paste0( "(", - paste0(utils::head(components, -1), collapse = sep), + paste(utils::head(components, -1), collapse = sep), ")", sep, utils::tail(components, 1) ) } else { - components <- paste0(components, collapse = sep) + components <- paste(components, collapse = sep) } } else { - components <- paste0(components, collapse = sep) + components <- paste(components, collapse = sep) } components } @@ -438,7 +438,7 @@ format_parameters.parameters_model <- function(model, ...) { # extract single coefficient names from interaction term out <- unlist(strsplit(i, ":", fixed = TRUE)) # combine labels - labs <- c(labs, paste0(sapply(out, function(l) pretty_labels[l]), collapse = " * ")) + labs <- c(labs, paste(sapply(out, function(l) pretty_labels[l]), collapse = " * ")) } # add interaction terms to labels string names(labs) <- names(interactions) @@ -467,10 +467,10 @@ format_parameters.parameters_model <- function(model, ...) { win_os <- tryCatch( { si <- Sys.info() - if (!is.null(si["sysname"])) { - si["sysname"] == "Windows" || startsWith(R.version$os, "mingw") - } else { + if (is.null(si["sysname"])) { FALSE + } else { + si["sysname"] == "Windows" || startsWith(R.version$os, "mingw") } }, error = function(e) {