Skip to content

Commit

Permalink
prepare CRAN release (#902)
Browse files Browse the repository at this point in the history
* prepare CRAN release

* add dep

* Update DESCRIPTION

* Update test-brms_gr_random_effects.R

* minior

* lintr

* style

* submitted
  • Loading branch information
strengejacke authored Jul 13, 2024
1 parent afe04c1 commit 94af4cb
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 62 deletions.
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -93,6 +93,7 @@ Suggests:
betareg,
bife,
biglm,
BH,
blavaan (>= 0.5-5),
blme,
boot,
Expand Down Expand Up @@ -180,6 +181,7 @@ Suggests:
psych,
quantreg,
Rcpp,
RcppEigen,
rmarkdown,
rms,
robustbase,
Expand Down Expand Up @@ -212,4 +214,3 @@ Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
Config/testthat/parallel: true
Config/Needs/website: easystats/easystatstemplate
Remotes: easystats/performance
4 changes: 0 additions & 4 deletions R/find_random.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
Expand All @@ -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(
Expand All @@ -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))
}
31 changes: 1 addition & 30 deletions R/helper_functions.R
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -122,7 +122,6 @@
}



# extract random effects from formula
.get_model_random <- function(f, model, split_nested = FALSE) {
is_special <- inherits(
Expand Down Expand Up @@ -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()
Expand All @@ -220,10 +218,8 @@
}



# helper to access model components ----------------


.all_elements <- function() {
c(
"conditional", "conditional1", "conditional2", "conditional3", "precision",
Expand Down Expand Up @@ -284,7 +280,6 @@
return(auxiliary_parameters)
}


elements <- switch(effects,
all = elements,
fixed = elements[!elements %in% random_parameters],
Expand All @@ -304,7 +299,6 @@
}



# Filter parameters from Stan-model fits
.filter_pars <- function(l, parameters = NULL, is_mv = NULL) {
if (!is.null(parameters)) {
Expand All @@ -325,7 +319,6 @@
}



.filter_pars_univariate <- function(l, parameters) {
lapply(l, function(component) {
unlist(sapply(
Expand All @@ -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(") |
Expand All @@ -364,15 +355,13 @@
}



.grep_zi_smoothers <- function(x) {
grepl("^(s\\.\\d\\()", x, perl = TRUE) |
grepl("^(gam::s\\.\\d\\()", x, perl = TRUE) |
grepl("^(mgcv::s\\.\\d\\()", x, perl = TRUE)
}



.grep_non_smoothers <- function(x) {
grepl("^(?!(s\\())", x, perl = TRUE) &
# this one captures smoothers in zi- or mv-models from gam
Expand All @@ -393,7 +382,6 @@
}



# .split_formula <- function(f) {
# rhs <- if (length(f) > 2L)
# f[[3L]]
Expand All @@ -418,7 +406,6 @@
# }



.gam_family <- function(x) {
faminfo <- .safe(stats::family(x))

Expand All @@ -431,7 +418,6 @@
}



# for models with zero-inflation component, return
# required component of model-summary
.filter_component <- function(dat, component) {
Expand All @@ -452,8 +438,6 @@
}




#' @keywords internal
.gather <- function(x,
names_to = "key",
Expand All @@ -480,7 +464,6 @@
}



.is_baysian_emmeans <- function(x) {
if (inherits(x, "emm_list")) {
x <- x[[1]]
Expand All @@ -490,7 +473,6 @@
}



.is_bayesian_model <- function(x) {
inherits(x, c(
"brmsfit", "stanfit", "MCMCglmm", "stanreg",
Expand All @@ -502,7 +484,6 @@
}



# safe conversion from factor to numeric
.factor_to_numeric <- function(x, lowest = NULL) {
if (is.data.frame(x)) {
Expand Down Expand Up @@ -549,9 +530,6 @@
}





## copied from lme4::findbars() -----------------------


Expand All @@ -567,7 +545,6 @@
}



.expandDoubleVerts <- function(term) {
if (!is.name(term) && is.language(term)) {
if (term[[1]] == as.name("(")) {
Expand All @@ -586,7 +563,6 @@
}



.findbars <- function(term) {
fb <- function(term) {
if (is.name(term) || !is.language(term)) {
Expand Down Expand Up @@ -651,8 +627,6 @@
}




## copied from lme4::nobars() -----------------------


Expand All @@ -672,7 +646,6 @@
}



.nobars_ <- function(term) {
if (!(any(c("|", "||") %in% all.names(term)))) {
return(term)
Expand Down Expand Up @@ -712,7 +685,6 @@
}



.isBar <- function(term) {
if (is.call(term) && ((term[[1]] == as.name("|") || term[[1]] == as.name("||")))) {
return(TRUE)
Expand All @@ -733,7 +705,6 @@
}



# classify emmeans objects -------------


Expand Down
16 changes: 8 additions & 8 deletions R/print.easystats_check.R
Original file line number Diff line number Diff line change
@@ -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)
}
2 changes: 1 addition & 1 deletion R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ safe_deparse_symbol <- function(x) {
} else {
out <- NULL
}
return(out)
out
}


Expand Down
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion tests/testthat/test-GLMMadaptive.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-brms_gr_random_effects.R
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-r2_nakagawa_bernoulli.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-r2_nakagawa_beta.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")


# ==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-r2_nakagawa_binomial.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")


# ==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-r2_nakagawa_gamma.R
Original file line number Diff line number Diff line change
@@ -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 ----
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-r2_nakagawa_linear.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")


# ==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-r2_nakagawa_negbin.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")


# ==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-r2_nakagawa_negbin_zi.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")


# ==============================================================================
Expand Down
Loading

0 comments on commit 94af4cb

Please sign in to comment.