diff --git a/R/extract_parameters.R b/R/extract_parameters.R index 2b8543630..61411246c 100644 --- a/R/extract_parameters.R +++ b/R/extract_parameters.R @@ -945,12 +945,12 @@ } type <- switch(standardize, - "all" = , - "std.all" = "std.all", - "latent" = , - "std.lv" = "std.lv", - "no_exogenous" = , - "std.nox" = "std.nox", + all = , + std.all = "std.all", + latent = , + std.lv = "std.lv", + no_exogenous = , + std.nox = "std.nox", "std.all" ) diff --git a/R/extract_parameters_anova.R b/R/extract_parameters_anova.R index 69cd2d8b7..ab3e2df9b 100644 --- a/R/extract_parameters_anova.R +++ b/R/extract_parameters_anova.R @@ -226,10 +226,10 @@ } eigs <- Re(eigen(qr.coef(qr_value, model$SSP[[i]]), symmetric = FALSE)$values) test <- switch(model$test, - "Pillai" = .pillai_test(eigs, model$df[i], model$error.df), - "Wilks" = .wilks_test(eigs, model$df[i], model$error.df), - "Hotelling-Lawley" = .hl_test(eigs, model$df[i], model$error.df), - "Roy" = .roy_test(eigs, model$df[i], model$error.df) + Pillai = .pillai_test(eigs, model$df[i], model$error.df), + Wilks = .wilks_test(eigs, model$df[i], model$error.df), + `Hotelling-Lawley` = .hl_test(eigs, model$df[i], model$error.df), + Roy = .roy_test(eigs, model$df[i], model$error.df) ) data.frame( Parameter = model$terms[i], diff --git a/R/extract_random_parameters.R b/R/extract_random_parameters.R index cdd8e7d8c..c8dc8325d 100644 --- a/R/extract_random_parameters.R +++ b/R/extract_random_parameters.R @@ -64,9 +64,9 @@ # filter component out <- switch(component, - "zi" = , - "zero_inflated" = out[out$Component == "zi", ], - "conditional" = out[out$Component == "cond", ], + zi = , + zero_inflated = out[out$Component == "zi", ], + conditional = out[out$Component == "cond", ], out ) diff --git a/R/format_df_adjust.R b/R/format_df_adjust.R index 6f6377461..458a45afe 100644 --- a/R/format_df_adjust.R +++ b/R/format_df_adjust.R @@ -19,15 +19,15 @@ format_df_adjust <- function(method, method <- tolower(method) out <- switch(method, - "kr" = , - "kenward-rogers" = , - "kenward-roger" = , - "kenward" = "Kenward-Roger", - "ml1" = "m-l-1", - "betwithin" = , - "bw" = "Between-within", - "fit" = "Residual", - "boot" = "Bootstrapped", + kr = , + `kenward-rogers` = , + `kenward-roger` = , + kenward = "Kenward-Roger", + ml1 = "m-l-1", + betwithin = , + bw = "Between-within", + fit = "Residual", + boot = "Bootstrapped", insight::format_capitalize(method) ) diff --git a/R/format_order.R b/R/format_order.R index e03c1684b..583324a53 100644 --- a/R/format_order.R +++ b/R/format_order.R @@ -17,15 +17,15 @@ format_order <- function(order, textual = TRUE, ...) { order <- insight::format_number(order) parts <- unlist(strsplit(order, " ", fixed = TRUE)) parts[length(parts)] <- switch(utils::tail(parts, 1), - "one" = "first", - "two" = "second", - "three" = "third", - "four" = "fourth", - "five" = "fifth", - "six" = "sixth", - "seven" = "seventh", - "eight" = "eigth", - "nine" = "ninth" + one = "first", + two = "second", + three = "third", + four = "fourth", + five = "fifth", + six = "sixth", + seven = "seventh", + eight = "eigth", + nine = "ninth" ) out <- paste(parts, collapse = " ") } else { @@ -39,16 +39,16 @@ format_order <- function(order, textual = TRUE, ...) { out <- paste0( number, switch(last, - "1" = "st", - "2" = "nd", - "3" = "rd", - "4" = "th", - "5" = "th", - "6" = "th", - "7" = "th", - "8" = "th", - "9" = "th", - "0" = "th" + `1` = "st", + `2` = "nd", + `3` = "rd", + `4` = "th", + `5` = "th", + `6` = "th", + `7` = "th", + `8` = "th", + `9` = "th", + `0` = "th" ) ) } diff --git a/R/format_p_adjust.R b/R/format_p_adjust.R index 024257ba8..b1b4713a8 100644 --- a/R/format_p_adjust.R +++ b/R/format_p_adjust.R @@ -15,16 +15,16 @@ format_p_adjust <- function(method) { method <- tolower(method) switch(method, - "holm" = "Holm (1979)", - "hochberg" = "Hochberg (1988)", - "hommel" = "Hommel (1988)", - "bonferroni" = "Bonferroni", - "fdr" = "Benjamini & Hochberg (1995)", - "bh" = "Benjamini & Hochberg (1995)", - "by" = "Benjamini & Yekutieli (2001)", - "tukey" = "Tukey", - "scheffe" = "Scheffe", - "sidak" = "Sidak", + holm = "Holm (1979)", + hochberg = "Hochberg (1988)", + hommel = "Hommel (1988)", + bonferroni = "Bonferroni", + fdr = "Benjamini & Hochberg (1995)", + bh = "Benjamini & Hochberg (1995)", + by = "Benjamini & Yekutieli (2001)", + tukey = "Tukey", + scheffe = "Scheffe", + sidak = "Sidak", method ) } diff --git a/R/format_parameters.R b/R/format_parameters.R index 757e9d998..99538aae4 100644 --- a/R/format_parameters.R +++ b/R/format_parameters.R @@ -345,9 +345,9 @@ format_parameters.parameters_model <- function(model, ...) { #' @keywords internal .format_ordered <- function(degree, brackets = c("[", "]")) { switch(degree, - ".L" = paste0(brackets[1], "linear", brackets[2]), - ".Q" = paste0(brackets[1], "quadratic", brackets[2]), - ".C" = paste0(brackets[1], "cubic", brackets[2]), + `.L` = paste0(brackets[1], "linear", brackets[2]), + `.Q` = paste0(brackets[1], "quadratic", brackets[2]), + `.C` = paste0(brackets[1], "cubic", brackets[2]), paste0( brackets[1], parameters::format_order(as.numeric(gsub("^", "", degree, fixed = TRUE)), textual = FALSE), diff --git a/R/methods_aov.R b/R/methods_aov.R index 599849a9f..2e289aae8 100644 --- a/R/methods_aov.R +++ b/R/methods_aov.R @@ -353,12 +353,12 @@ model_parameters.maov <- model_parameters.aov return(type) } switch(type, - "1" = , - "I" = 1, - "2" = , - "II" = 2, - "3" = , - "III" = 3, + `1` = , + `I` = 1, + `2` = , + `II` = 2, + `3` = , + `III` = 3, 1 ) } diff --git a/R/methods_fixest.R b/R/methods_fixest.R index 9b008b0f5..bb2a04d17 100644 --- a/R/methods_fixest.R +++ b/R/methods_fixest.R @@ -101,8 +101,8 @@ degrees_of_freedom.fixest <- function(model, method = "wald", ...) { } method <- switch(method, - "wald" = "t", - "residual" = "resid" + wald = "t", + residual = "resid" ) fixest::degrees_freedom(model, type = method) } diff --git a/R/methods_lme4.R b/R/methods_lme4.R index fd70fe034..549317ef4 100644 --- a/R/methods_lme4.R +++ b/R/methods_lme4.R @@ -136,7 +136,7 @@ model_parameters.merMod <- function(model, ci_method <- "quantile" } else { ci_method <- switch(insight::find_statistic(model), - "t-statistic" = "residual", + `t-statistic` = "residual", "wald" ) } diff --git a/R/methods_metaplus.R b/R/methods_metaplus.R index 66b3e0664..b227844ff 100644 --- a/R/methods_metaplus.R +++ b/R/methods_metaplus.R @@ -417,7 +417,7 @@ ci.meta_bma <- ci.meta_random .metabma_ci_columns <- function(ci_method, ci) { switch(toupper(ci_method), - "HDI" = sprintf(c("hpd%i_lower", "hpd%i_upper"), 100 * ci), + HDI = sprintf(c("hpd%i_lower", "hpd%i_upper"), 100 * ci), c(sprintf("%g%%", (100 * (1 - ci)) / 2), sprintf("%g%%", 100 - (100 * (1 - ci)) / 2)) ) } diff --git a/R/methods_mmrm.R b/R/methods_mmrm.R index 0b62fb890..af3b35469 100644 --- a/R/methods_mmrm.R +++ b/R/methods_mmrm.R @@ -15,7 +15,7 @@ model_parameters.mmrm <- function(model, verbose = TRUE, ...) { ci_method <- switch(model$method, - "Satterthwaite" = "satterthwaite", + Satterthwaite = "satterthwaite", "kenward" ) diff --git a/R/methods_quantreg.R b/R/methods_quantreg.R index d4f75a641..4685fda8e 100644 --- a/R/methods_quantreg.R +++ b/R/methods_quantreg.R @@ -144,9 +144,9 @@ standard_error.rqss <- function(model, ) switch(component, - "all" = rbind(out_cond, out_smooth), - "conditional" = out_cond, - "smooth_terms" = out_smooth + all = rbind(out_cond, out_smooth), + conditional = out_cond, + smooth_terms = out_smooth ) } @@ -269,9 +269,9 @@ p_value.rqss <- function(model, ) switch(component, - "all" = rbind(out_cond, out_smooth), - "conditional" = out_cond, - "smooth_terms" = out_smooth + all = rbind(out_cond, out_smooth), + conditional = out_cond, + smooth_terms = out_smooth ) } diff --git a/R/p_calibrate.R b/R/p_calibrate.R index 9ecd56b8e..d323f2e76 100644 --- a/R/p_calibrate.R +++ b/R/p_calibrate.R @@ -92,7 +92,7 @@ format.p_calibrate <- function(x, ...) { print.p_calibrate <- function(x, ...) { formatted <- format(x, ...) footer <- switch(attributes(x)$type, - "frequentist" = "Calibrated p-values indicate the posterior probability of H0.\n", + frequentist = "Calibrated p-values indicate the posterior probability of H0.\n", "Calibrated p-values indicate the Bayes Factor (evidence) in favor of H0 over H1.\n" ) cat(insight::export_table(formatted, footer = c(footer, "blue"), ...)) diff --git a/R/sort_parameters.R b/R/sort_parameters.R index 7d6a0c11f..38f69e5ba 100644 --- a/R/sort_parameters.R +++ b/R/sort_parameters.R @@ -40,8 +40,8 @@ sort_parameters.default <- function(x, sort = "none", column = "Coefficient", .. # new row indices to use for sorting new_row_order <- switch(sort, - "ascending" = order(x[[column]], decreasing = FALSE), - "descending" = order(x[[column]], decreasing = TRUE) + ascending = order(x[[column]], decreasing = FALSE), + descending = order(x[[column]], decreasing = TRUE) ) x[new_row_order, ] diff --git a/R/utils.R b/R/utils.R index fd1783303..bb142b06d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -51,9 +51,9 @@ #' @keywords internal .filter_component <- function(dat, component) { switch(component, - "conditional" = dat[dat$Component == "conditional", ], - "zi" = , - "zero_inflated" = dat[dat$Component == "zero_inflated", ], + conditional = dat[dat$Component == "conditional", ], + zi = , + zero_inflated = dat[dat$Component == "zero_inflated", ], dat ) } diff --git a/R/utils_model_parameters.R b/R/utils_model_parameters.R index 1f375b99a..eb62012a1 100644 --- a/R/utils_model_parameters.R +++ b/R/utils_model_parameters.R @@ -241,7 +241,7 @@ emmean = "Marginal Means", rate = "Estimated Counts", ratio = "Ratio", - Coefficient + "Coefficient" ) } } else if (!is.null(info) && !info$family == "unknown") {