From c152793f2433fd1349906138f661a36d44815bf0 Mon Sep 17 00:00:00 2001 From: aloctavodia Date: Fri, 5 Dec 2025 08:32:33 +0200 Subject: [PATCH 1/4] Use reformulas for formula processing functions --- DESCRIPTION | 3 ++- NEWS.md | 2 +- R/divergence_minimizers.R | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e7154b4ec..7dd5e80f0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -56,7 +56,8 @@ Imports: MASS, ordinal, nnet, - mclogit + mclogit, + reformulas, Suggests: ggrepel, ggfortify, diff --git a/NEWS.md b/NEWS.md index adca22ad8..6ca8b6572 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,7 +9,7 @@ If you read this from a place other than = v1.1-38. ## Bug fixes diff --git a/R/divergence_minimizers.R b/R/divergence_minimizers.R index fdd3eae13..5f4bf6a2c 100644 --- a/R/divergence_minimizers.R +++ b/R/divergence_minimizers.R @@ -52,7 +52,7 @@ divmin <- function( sdivmin <- fit_glmer_callback if (getOption("projpred.PQL", FALSE)) { # Split up the formula into a fixed and a random part (note: we could also - # use lme4::nobars() and lme4::findbars() here): + # use reformulas::nobars() and reformulas::findbars() here): formula_random <- split_formula_random_gamm4(formula) projpred_formulas_no_random <- validate_response_formula( formula_random$formula @@ -1342,11 +1342,11 @@ empty_intersection <- function(x, el_nm = "new") { # "GPL (>=2)" (see ). mkNewReTrms_man <- function(re.form, newdata, xlevels, re, D = NULL) { stopifnot(!is.null(newdata)) - tt <- terms(lme4::subbars(re.form)) + tt <- terms(reformulas::subbars(re.form)) rfd <- suppressWarnings( model.frame(tt, newdata, na.action = na.pass, xlev = xlevels) ) - ReTrms <- lme4::mkReTrms(lme4::findbars(re.form[[2]]), rfd) + ReTrms <- reformulas::mkReTrms(reformulas::findbars(re.form[[2]]), rfd) ns.re <- names(re) nRnms <- names(Rcnms <- ReTrms$cnms) if (!all(nRnms %in% ns.re)) { From d0b17cfa50e0aae2cc63db3b6fd9e45373933e69 Mon Sep 17 00:00:00 2001 From: aloctavodia Date: Fri, 5 Dec 2025 09:02:36 +0200 Subject: [PATCH 2/4] remove warning catching --- tests/testthat/test_refmodel.R | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/testthat/test_refmodel.R b/tests/testthat/test_refmodel.R index e75e58825..fc2f755f4 100644 --- a/tests/testthat/test_refmodel.R +++ b/tests/testthat/test_refmodel.R @@ -265,11 +265,6 @@ test_that(paste( weightsnew = wobs_crr, offsetnew = offs_crr, type = "response"), - warning = function(w) { - if (grepl("nobars.*reformulas", conditionMessage(w))) { - invokeRestart("muffleWarning") - } - } ), get_warn_wrhs_orhs(tstsetup, weightsnew = wobs_crr, From 219b6f56bd328c29f720104142e04ab12c4dada2 Mon Sep 17 00:00:00 2001 From: aloctavodia Date: Fri, 5 Dec 2025 09:58:18 +0200 Subject: [PATCH 3/4] fix typo --- tests/testthat/test_refmodel.R | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/testthat/test_refmodel.R b/tests/testthat/test_refmodel.R index fc2f755f4..0c8480974 100644 --- a/tests/testthat/test_refmodel.R +++ b/tests/testthat/test_refmodel.R @@ -260,15 +260,10 @@ test_that(paste( # Without `ynew`: expect_warning( - predref_resp <- withCallingHandlers( - predict(refmods[[tstsetup]], dat, - weightsnew = wobs_crr, - offsetnew = offs_crr, - type = "response"), - ), - get_warn_wrhs_orhs(tstsetup, - weightsnew = wobs_crr, - offsetnew = offs_crr), + predref_resp <- predict(refmods[[tstsetup]], dat, weightsnew = wobs_crr, + offsetnew = offs_crr, type = "response"), + get_warn_wrhs_orhs(tstsetup, weightsnew = wobs_crr, + offsetnew = offs_crr), info = tstsetup ) From 2b509ed0c2345fa155da46658d36d54a8a33aadb Mon Sep 17 00:00:00 2001 From: aloctavodia Date: Fri, 5 Dec 2025 10:41:32 +0200 Subject: [PATCH 4/4] expand warn catching --- tests/testthat/test_refmodel.R | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test_refmodel.R b/tests/testthat/test_refmodel.R index 0c8480974..6a87083b0 100644 --- a/tests/testthat/test_refmodel.R +++ b/tests/testthat/test_refmodel.R @@ -260,8 +260,15 @@ test_that(paste( # Without `ynew`: expect_warning( - predref_resp <- predict(refmods[[tstsetup]], dat, weightsnew = wobs_crr, - offsetnew = offs_crr, type = "response"), + withCallingHandlers( + predref_resp <- predict(refmods[[tstsetup]], dat, weightsnew = wobs_crr, + offsetnew = offs_crr, type = "response"), + warning = function(w) { + if (grepl("(nobars|subbars|findbars|mkReTrms).*reformulas", conditionMessage(w))) { + invokeRestart("muffleWarning") + } + } + ), get_warn_wrhs_orhs(tstsetup, weightsnew = wobs_crr, offsetnew = offs_crr), info = tstsetup