diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 9117973ba..ccca724fc 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 0.20.1 -Date: 2024-06-11 14:53:20 UTC -SHA: 622b973d4f2c62cb42d6fc4b4c04907533096fcb +Version: 0.20.2 +Date: 2024-07-13 14:49:57 UTC +SHA: 37daa8e0de05efc3991dee23a895598725cbff3e diff --git a/DESCRIPTION b/DESCRIPTION index 70914217b..59eb49380 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: insight Title: Easy Access to Model Information for Various Model Objects -Version: 0.20.1.14 +Version: 0.20.2 Authors@R: c(person(given = "Daniel", family = "Lüdecke", @@ -93,6 +93,7 @@ Suggests: betareg, bife, biglm, + BH, blavaan (>= 0.5-5), blme, boot, @@ -180,6 +181,7 @@ Suggests: psych, quantreg, Rcpp, + RcppEigen, rmarkdown, rms, robustbase, @@ -212,4 +214,3 @@ Roxygen: list(markdown = TRUE) Config/testthat/edition: 3 Config/testthat/parallel: true Config/Needs/website: easystats/easystatstemplate -Remotes: easystats/performance diff --git a/R/find_random.R b/R/find_random.R index 98b816358..62d1cba62 100644 --- a/R/find_random.R +++ b/R/find_random.R @@ -54,7 +54,6 @@ find_random.default <- function(x, split_nested = FALSE, flatten = FALSE) { l <- .find_random_effects(x, f, split_nested) } - if (is_empty_object(l)) { return(NULL) } @@ -76,7 +75,6 @@ find_random.afex_aov <- function(x, split_nested = FALSE, flatten = FALSE) { } - .find_random_effects <- function(x, f, split_nested) { if (!object_has_names(f, "random") && !object_has_names(f, "zero_inflated_random")) { return(NULL) @@ -100,7 +98,6 @@ find_random.afex_aov <- function(x, split_nested = FALSE, flatten = FALSE) { r1 <- NULL } - if (object_has_names(f, "zero_inflated_random")) { if (is.list(f$zero_inflated_random)) { r2 <- unique(unlist( @@ -114,6 +111,5 @@ find_random.afex_aov <- function(x, split_nested = FALSE, flatten = FALSE) { r2 <- NULL } - compact_list(list(random = r1, zero_inflated_random = r2)) } diff --git a/R/helper_functions.R b/R/helper_functions.R index 3aecf2820..6aa5fcc02 100644 --- a/R/helper_functions.R +++ b/R/helper_functions.R @@ -1,6 +1,6 @@ # small wrapper around this commonly used try-catch .safe <- function(code, on_error = NULL) { - if (isTRUE(getOption("easystats_erros", FALSE)) && is.null(on_error)) { + if (isTRUE(getOption("easystats_errors", FALSE)) && is.null(on_error)) { code } else { tryCatch(code, error = function(e) on_error) @@ -122,7 +122,6 @@ } - # extract random effects from formula .get_model_random <- function(f, model, split_nested = FALSE) { is_special <- inherits( @@ -195,7 +194,6 @@ } - # in case we need the random effects terms as formula (symbol), # not as character string, then call this functions instead of # .get_model_random() @@ -220,10 +218,8 @@ } - # helper to access model components ---------------- - .all_elements <- function() { c( "conditional", "conditional1", "conditional2", "conditional3", "precision", @@ -284,7 +280,6 @@ return(auxiliary_parameters) } - elements <- switch(effects, all = elements, fixed = elements[!elements %in% random_parameters], @@ -304,7 +299,6 @@ } - # Filter parameters from Stan-model fits .filter_pars <- function(l, parameters = NULL, is_mv = NULL) { if (!is.null(parameters)) { @@ -325,7 +319,6 @@ } - .filter_pars_univariate <- function(l, parameters) { lapply(l, function(component) { unlist(sapply( @@ -339,14 +332,12 @@ } - # remove column .remove_column <- function(data, variables) { data[, -which(colnames(data) %in% variables), drop = FALSE] } - .grep_smoothers <- function(x) { startsWith(x, "s(") | startsWith(x, "ti(") | @@ -364,7 +355,6 @@ } - .grep_zi_smoothers <- function(x) { grepl("^(s\\.\\d\\()", x, perl = TRUE) | grepl("^(gam::s\\.\\d\\()", x, perl = TRUE) | @@ -372,7 +362,6 @@ } - .grep_non_smoothers <- function(x) { grepl("^(?!(s\\())", x, perl = TRUE) & # this one captures smoothers in zi- or mv-models from gam @@ -393,7 +382,6 @@ } - # .split_formula <- function(f) { # rhs <- if (length(f) > 2L) # f[[3L]] @@ -418,7 +406,6 @@ # } - .gam_family <- function(x) { faminfo <- .safe(stats::family(x)) @@ -431,7 +418,6 @@ } - # for models with zero-inflation component, return # required component of model-summary .filter_component <- function(dat, component) { @@ -452,8 +438,6 @@ } - - #' @keywords internal .gather <- function(x, names_to = "key", @@ -480,7 +464,6 @@ } - .is_baysian_emmeans <- function(x) { if (inherits(x, "emm_list")) { x <- x[[1]] @@ -490,7 +473,6 @@ } - .is_bayesian_model <- function(x) { inherits(x, c( "brmsfit", "stanfit", "MCMCglmm", "stanreg", @@ -502,7 +484,6 @@ } - # safe conversion from factor to numeric .factor_to_numeric <- function(x, lowest = NULL) { if (is.data.frame(x)) { @@ -549,9 +530,6 @@ } - - - ## copied from lme4::findbars() ----------------------- @@ -567,7 +545,6 @@ } - .expandDoubleVerts <- function(term) { if (!is.name(term) && is.language(term)) { if (term[[1]] == as.name("(")) { @@ -586,7 +563,6 @@ } - .findbars <- function(term) { fb <- function(term) { if (is.name(term) || !is.language(term)) { @@ -651,8 +627,6 @@ } - - ## copied from lme4::nobars() ----------------------- @@ -672,7 +646,6 @@ } - .nobars_ <- function(term) { if (!(any(c("|", "||") %in% all.names(term)))) { return(term) @@ -712,7 +685,6 @@ } - .isBar <- function(term) { if (is.call(term) && ((term[[1]] == as.name("|") || term[[1]] == as.name("||")))) { return(TRUE) @@ -733,7 +705,6 @@ } - # classify emmeans objects ------------- diff --git a/R/print.easystats_check.R b/R/print.easystats_check.R index 8c530ffa6..f71701f08 100644 --- a/R/print.easystats_check.R +++ b/R/print.easystats_check.R @@ -1,21 +1,21 @@ #' @export print.easystats_check <- function(x, ...) { # check attributes - title <- attr(x, "title") - text <- attr(x, "text") + my_title <- attr(x, "title") + my_text <- attr(x, "text") color <- attr(x, "color") # no attributes found? check list elements then... - if (is.null(title) && is.null(text) && is.null(color)) { - if ("title" %in% names(x)) title <- x$title - if ("text" %in% names(x)) text <- x$text + if (is.null(my_title) && is.null(my_text) && is.null(color)) { + if ("title" %in% names(x)) my_title <- x$title + if ("text" %in% names(x)) my_text <- x$text if ("color" %in% names(x)) color <- x$color } - if (!is.null(title)) { - print_color(paste0("# ", title, "\n\n"), "blue") + if (!is.null(my_title)) { + print_color(paste0("# ", my_title, "\n\n"), "blue") } - print_color(text, color) + print_color(my_text, color) invisible(x) } diff --git a/R/utilities.R b/R/utilities.R index 620784a5d..372eceb8b 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -131,7 +131,7 @@ safe_deparse_symbol <- function(x) { } else { out <- NULL } - return(out) + out } diff --git a/cran-comments.md b/cran-comments.md index 90e6bebb0..127ca3820 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1 +1 @@ -This is a hotfix release that fixes memory allocation issues when `insight::get_datagrid()` was called with the deprecated argument `at = NULL`. +Maintainance release. diff --git a/tests/testthat/test-GLMMadaptive.R b/tests/testthat/test-GLMMadaptive.R index cdf95fac4..be014f897 100644 --- a/tests/testthat/test-GLMMadaptive.R +++ b/tests/testthat/test-GLMMadaptive.R @@ -384,7 +384,7 @@ test_that("detect custom families", { # we set the zeros from the logistic regression DF$y[as.logical(rbinom(n * K, size = 1, prob = plogis(eta_zi)))] <- 0 - hurdle.lognormal <- function() { + hurdle.lognormal <- function() { stats <- make.link("identity") log_dens <- function(y, eta, mu_fun, phis, eta_zi) { sigma <- exp(phis) diff --git a/tests/testthat/test-brms_gr_random_effects.R b/tests/testthat/test-brms_gr_random_effects.R index 3e7ff5a40..b997ea2b8 100644 --- a/tests/testthat/test-brms_gr_random_effects.R +++ b/tests/testthat/test-brms_gr_random_effects.R @@ -1,6 +1,8 @@ skip_on_cran() skip_on_os("mac") skip_if_not_installed("brms") +skip_if_not_installed("BH") +skip_if_not_installed("RcppEigen") skip_if_not_installed("withr") withr::with_environment( diff --git a/tests/testthat/test-r2_nakagawa_bernoulli.R b/tests/testthat/test-r2_nakagawa_bernoulli.R index 238b1d745..1a04d27e7 100644 --- a/tests/testthat/test-r2_nakagawa_bernoulli.R +++ b/tests/testthat/test-r2_nakagawa_bernoulli.R @@ -3,7 +3,7 @@ skip_on_cran() skip_if_not_installed("glmmTMB") skip_if_not_installed("MuMIn") skip_if_not_installed("lme4") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") skip_if_not_installed("datawizard") diff --git a/tests/testthat/test-r2_nakagawa_beta.R b/tests/testthat/test-r2_nakagawa_beta.R index ecbd56c6b..2a89d413b 100644 --- a/tests/testthat/test-r2_nakagawa_beta.R +++ b/tests/testthat/test-r2_nakagawa_beta.R @@ -2,7 +2,7 @@ skip_on_cran() skip_if_not_installed("glmmTMB") skip_if_not_installed("MuMIn") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") # ============================================================================== diff --git a/tests/testthat/test-r2_nakagawa_binomial.R b/tests/testthat/test-r2_nakagawa_binomial.R index 660dc83e6..9c6391580 100644 --- a/tests/testthat/test-r2_nakagawa_binomial.R +++ b/tests/testthat/test-r2_nakagawa_binomial.R @@ -3,7 +3,7 @@ skip_on_cran() skip_if_not_installed("glmmTMB") skip_if_not_installed("MuMIn") skip_if_not_installed("lme4") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") # ============================================================================== diff --git a/tests/testthat/test-r2_nakagawa_gamma.R b/tests/testthat/test-r2_nakagawa_gamma.R index 48185123d..9a8bfe114 100644 --- a/tests/testthat/test-r2_nakagawa_gamma.R +++ b/tests/testthat/test-r2_nakagawa_gamma.R @@ -1,7 +1,7 @@ skip_on_cran() skip_if_not_installed("MuMIn") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") # ============================================================================== # Gamma mixed models, glmmTMB ---- diff --git a/tests/testthat/test-r2_nakagawa_linear.R b/tests/testthat/test-r2_nakagawa_linear.R index d51ba4ea1..af2abe838 100644 --- a/tests/testthat/test-r2_nakagawa_linear.R +++ b/tests/testthat/test-r2_nakagawa_linear.R @@ -3,7 +3,7 @@ skip_on_cran() skip_if_not_installed("glmmTMB") skip_if_not_installed("MuMIn") skip_if_not_installed("lme4") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") # ============================================================================== diff --git a/tests/testthat/test-r2_nakagawa_negbin.R b/tests/testthat/test-r2_nakagawa_negbin.R index 587eb7870..691b0e759 100644 --- a/tests/testthat/test-r2_nakagawa_negbin.R +++ b/tests/testthat/test-r2_nakagawa_negbin.R @@ -3,7 +3,7 @@ skip_on_cran() skip_if_not_installed("glmmTMB") skip_if_not_installed("MuMIn") skip_if_not_installed("lme4") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") # ============================================================================== diff --git a/tests/testthat/test-r2_nakagawa_negbin_zi.R b/tests/testthat/test-r2_nakagawa_negbin_zi.R index 582adde60..73b49b79e 100644 --- a/tests/testthat/test-r2_nakagawa_negbin_zi.R +++ b/tests/testthat/test-r2_nakagawa_negbin_zi.R @@ -2,7 +2,7 @@ skip_on_cran() skip_if_not_installed("glmmTMB") skip_if_not_installed("MuMIn") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") # ============================================================================== diff --git a/tests/testthat/test-r2_nakagawa_ordered_beta.R b/tests/testthat/test-r2_nakagawa_ordered_beta.R index 2b3cac3ff..133ec4450 100644 --- a/tests/testthat/test-r2_nakagawa_ordered_beta.R +++ b/tests/testthat/test-r2_nakagawa_ordered_beta.R @@ -1,7 +1,7 @@ skip_on_cran() skip_if_not_installed("glmmTMB", minimum_version = "1.1.8") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") skip_if_not_installed("withr") diff --git a/tests/testthat/test-r2_nakagawa_poisson.R b/tests/testthat/test-r2_nakagawa_poisson.R index 53043de98..99dedc77d 100644 --- a/tests/testthat/test-r2_nakagawa_poisson.R +++ b/tests/testthat/test-r2_nakagawa_poisson.R @@ -3,7 +3,7 @@ skip_on_cran() skip_if_not_installed("glmmTMB") skip_if_not_installed("MuMIn") skip_if_not_installed("lme4") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") # ============================================================================== diff --git a/tests/testthat/test-r2_nakagawa_poisson_zi.R b/tests/testthat/test-r2_nakagawa_poisson_zi.R index 199dd51d7..25a3b20df 100644 --- a/tests/testthat/test-r2_nakagawa_poisson_zi.R +++ b/tests/testthat/test-r2_nakagawa_poisson_zi.R @@ -2,7 +2,7 @@ skip_on_cran() skip_if_not_installed("glmmTMB") skip_if_not_installed("MuMIn") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") # ============================================================================== diff --git a/tests/testthat/test-r2_nakagawa_truncated_poisson.R b/tests/testthat/test-r2_nakagawa_truncated_poisson.R index f6b3f29d3..ccc7d0197 100644 --- a/tests/testthat/test-r2_nakagawa_truncated_poisson.R +++ b/tests/testthat/test-r2_nakagawa_truncated_poisson.R @@ -2,7 +2,7 @@ skip_on_cran() skip_if_not_installed("glmmTMB") skip_if_not_installed("MuMIn") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") # ============================================================================== diff --git a/tests/testthat/test-r2_nakagawa_tweedie.R b/tests/testthat/test-r2_nakagawa_tweedie.R index f004d5948..35bcbe7f3 100644 --- a/tests/testthat/test-r2_nakagawa_tweedie.R +++ b/tests/testthat/test-r2_nakagawa_tweedie.R @@ -2,7 +2,7 @@ skip_on_cran() skip_if_not_installed("cplm") skip_if_not_installed("glmmTMB") -skip_if_not_installed("performance") +skip_if_not_installed("performance", minimum_version = "0.12.1") # cplm::cpglmm doesn't work suppressPackageStartupMessages({