Skip to content

Commit

Permalink
reverse deprecations for tidiers with R-oldrel dependency issues (#1204)
Browse files Browse the repository at this point in the history
* revert deprecation of lsmeans and emmeans
* revert emmeans and lsmeans deprecation messages
* don't install packages needing unavailable Matrix (these packages require R 4.3.0+ (maybe 4.4.0 for car and quantreg). car and quantreg use MatrixModels which uses an unavailable Matrix on oldrel-2 and previous.)
* address additional dependency conflicts
* skip Matrix ABI-dependent tests on R < 4.4.0
  • Loading branch information
simonpcouch committed May 16, 2024
1 parent d8baa1e commit f23d80e
Show file tree
Hide file tree
Showing 12 changed files with 310 additions and 125 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
extra-packages:
any::rcmdcheck,
AER=?ignore-before-r=4.3.0,
car=?ignore-before-r=4.3.0,
cobs=?ignore-before-r=4.3.0,
drc=?ignore-before-r=4.3.0,
emmeans=?ignore-before-r=4.3.0,
joineRML=?ignore-before-r=4.3.0,
lme4=?ignore-before-r=4.3.0,
lsmeans=?ignore-before-r=4.3.0,
quantreg=?ignore-before-r=4.3.0,
systemfit=?ignore-before-r=4.3.0
needs: check

- uses: r-lib/actions/check-r-package@v2
Expand Down
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ Suggests:
covr,
drc,
e1071,
emmeans,
epiR,
ergm (>= 3.10.4),
fixest (>= 0.9.0),
Expand All @@ -595,6 +596,7 @@ Suggests:
lme4,
lmodel2,
lmtest (>= 0.9.38),
lsmeans,
maps,
MASS,
mclust,
Expand Down
4 changes: 1 addition & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# broom (development version)

* Soft-deprecated tidiers for margins, lsmeans, and emmeans. Each package has been removed from Suggests and is no longer tested---their tidiers will raise a deprecation warning but return the same results as before.
- margins was archived from CRAN. In the case that the package is back on CRAN before the next package release, broom will once again Suggest and test support for the package (#1200).
- lsmeans and emmeans have a dependency requiring R 4.3.0 or higher. To maintain compatibility with at least 4 previous minor versions of R, broom won't test support for these packages until the release of R 4.7.x (or until lsmeans and emmeans are compatible with the R version 4 minor releases previous, #1193).
* Soft-deprecated tidiers for margins objects, as the package was archived from CRAN in April 2024. In the case that the package is back on CRAN before the next package release, broom will once again Suggest and test support for the package (#1200).

* While this broom release contains no changes to the `tidy.survfit()` method for objects from the survival package, the package has bumped the minimum required version for survival. Before survival 3.6-4, `tidy.survfit()` propagated "inconsistent" `n.censor` values from survival for multi-state models (#1195).

Expand Down
155 changes: 59 additions & 96 deletions R/emmeans-tidiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#'
#' @param x An `lsmobj` object.
#' @template param_confint
#' @param ... Additional arguments passed to `emmeans::summary.emmGrid()` or
#' `lsmeans::summary.ref.grid()`. **Cautionary note**: misspecified arguments
#' @param ... Additional arguments passed to [emmeans::summary.emmGrid()] or
#' [lsmeans::summary.ref.grid()]. **Cautionary note**: misspecified arguments
#' may be silently ignored!
#'
#' @evalRd return_tidy(
Expand All @@ -24,72 +24,62 @@
#' contrast, each row will contain one estimated contrast.
#'
#' There are a large number of arguments that can be
#' passed on to `emmeans::summary.emmGrid()` or `lsmeans::summary.ref.grid()`.
#' passed on to [emmeans::summary.emmGrid()] or [lsmeans::summary.ref.grid()].
#'
#' @examplesIf rlang::is_installed(c("emmeans", "ggplot2"))
#'
#' # load libraries for models and data
#' library(emmeans)
#'
#' # linear model for sales of oranges per day
#' oranges_lm1 <- lm(sales1 ~ price1 + price2 + day + store, data = oranges)
#'
#' # reference grid; see vignette("basics", package = "emmeans")
#' oranges_rg1 <- ref_grid(oranges_lm1)
#' td <- tidy(oranges_rg1)
#' td
#'
#' # marginal averages
#' marginal <- emmeans(oranges_rg1, "day")
#' tidy(marginal)
#'
#' # contrasts
#' tidy(contrast(marginal))
#' tidy(contrast(marginal, method = "pairwise"))
#'
#' # plot confidence intervals
#' library(ggplot2)
#'
#' ggplot(tidy(marginal, conf.int = TRUE), aes(day, estimate)) +
#' geom_point() +
#' geom_errorbar(aes(ymin = conf.low, ymax = conf.high))
#'
#' # by multiple prices
#' by_price <- emmeans(oranges_lm1, "day",
#' by = "price2",
#' at = list(
#' price1 = 50, price2 = c(40, 60, 80),
#' day = c("2", "3", "4")
#' )
#' )
#'
#' by_price
#'
#' tidy(by_price)
#'
#' ggplot(tidy(by_price, conf.int = TRUE), aes(price2, estimate, color = day)) +
#' geom_line() +
#' geom_errorbar(aes(ymin = conf.low, ymax = conf.high))
#'
#' # joint_tests
#' tidy(joint_tests(oranges_lm1))
#'
# examples no longer supplied, see #1193
# @examplesIf rlang::is_installed(c("emmeans", "ggplot2"))
#
# # load libraries for models and data
# library(emmeans)
#
# # linear model for sales of oranges per day
# oranges_lm1 <- lm(sales1 ~ price1 + price2 + day + store, data = oranges)
#
# # reference grid; see vignette("basics", package = "emmeans")
# oranges_rg1 <- ref_grid(oranges_lm1)
# td <- tidy(oranges_rg1)
# td
#
# # marginal averages
# marginal <- emmeans(oranges_rg1, "day")
# tidy(marginal)
#
# # contrasts
# tidy(contrast(marginal))
# tidy(contrast(marginal, method = "pairwise"))
#
# # plot confidence intervals
# library(ggplot2)
#
# ggplot(tidy(marginal, conf.int = TRUE), aes(day, estimate)) +
# geom_point() +
# geom_errorbar(aes(ymin = conf.low, ymax = conf.high))
#
# # by multiple prices
# by_price <- emmeans(oranges_lm1, "day",
# by = "price2",
# at = list(
# price1 = 50, price2 = c(40, 60, 80),
# day = c("2", "3", "4")
# )
# )
#
# by_price
#
# tidy(by_price)
#
# ggplot(tidy(by_price, conf.int = TRUE), aes(price2, estimate, color = day)) +
# geom_line() +
# geom_errorbar(aes(ymin = conf.low, ymax = conf.high))
#
# # joint_tests
# tidy(joint_tests(oranges_lm1))
#
#' @aliases emmeans_tidiers
#' @export
#' @family emmeans tidiers
#' @seealso [tidy()], `emmeans::ref_grid()`, `emmeans::emmeans()`,
#' `emmeans::contrast()`
#' @seealso [tidy()], [emmeans::ref_grid()], [emmeans::emmeans()],
#' [emmeans::contrast()]
tidy.lsmobj <- function(x, conf.int = FALSE, conf.level = .95, ...) {
lifecycle::deprecate_soft(
"1.0.6",
I("tidying a `lsmobj` object"),
details = c(
"i" = "broom no longer tests support for emmeans output as the package
requires an incompatibly recent R version.",
"!" = "Please interpret output with caution."
)
)
check_ellipses("exponentiate", "tidy", "lsmobj", ...)

tidy_emmeans(x, infer = c(conf.int, TRUE), level = conf.level, ...)
Expand All @@ -113,18 +103,9 @@ tidy.lsmobj <- function(x, conf.int = FALSE, conf.level = .95, ...) {
#'
#' @export
#' @family emmeans tidiers
#' @seealso [tidy()], `emmeans::ref_grid()`, `emmeans::emmeans()`,
#' `emmeans::contrast()`
#' @seealso [tidy()], [emmeans::ref_grid()], [emmeans::emmeans()],
#' [emmeans::contrast()]
tidy.ref.grid <- function(x, conf.int = FALSE, conf.level = .95, ...) {
lifecycle::deprecate_soft(
"1.0.6",
I("tidying a `ref.grid` object"),
details = c(
"i" = "broom no longer tests support for emmeans output as the package
requires an incompatibly recent R version.",
"!" = "Please interpret output with caution."
)
)
check_ellipses("exponentiate", "tidy", "ref.grid", ...)

tidy_emmeans(x, infer = c(conf.int, TRUE), level = conf.level, ...)
Expand All @@ -148,18 +129,9 @@ tidy.ref.grid <- function(x, conf.int = FALSE, conf.level = .95, ...) {
#'
#' @export
#' @family emmeans tidiers
#' @seealso [tidy()], `emmeans::ref_grid()`, `emmeans::emmeans()`,
#' `emmeans::contrast()`
#' @seealso [tidy()], [emmeans::ref_grid()], [emmeans::emmeans()],
#' [emmeans::contrast()]
tidy.emmGrid <- function(x, conf.int = FALSE, conf.level = .95, ...) {
lifecycle::deprecate_soft(
"1.0.6",
I("tidying a `emmGrid` object"),
details = c(
"i" = "broom no longer tests support for emmeans output as the package
requires an incompatibly recent R version.",
"!" = "Please interpret output with caution."
)
)
check_ellipses("exponentiate", "tidy", "emmGrid", ...)

tidy_emmeans(x, infer = c(conf.int, TRUE), level = conf.level, ...)
Expand Down Expand Up @@ -191,19 +163,10 @@ tidy.emmGrid <- function(x, conf.int = FALSE, conf.level = .95, ...) {
#'
#' @export
#' @family emmeans tidiers
#' @seealso [tidy()], `emmeans::ref_grid()`, `emmeans::emmeans()`,
#' `emmeans::contrast()`
#' @seealso [tidy()], [emmeans::ref_grid()], [emmeans::emmeans()],
#' [emmeans::contrast()]

tidy.summary_emm <- function(x, null.value = NULL, ...) {
lifecycle::deprecate_soft(
"1.0.6",
I("tidying a `summary_emm` object"),
details = c(
"i" = "broom no longer tests support for emmeans output as the package
requires an incompatibly recent R version.",
"!" = "Please interpret output with caution."
)
)
check_ellipses("exponentiate", "tidy", "summary_emm", ...)

tidy_emmeans_summary(x, null.value = null.value)
Expand Down
60 changes: 55 additions & 5 deletions man/tidy.emmGrid.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 55 additions & 5 deletions man/tidy.lsmobj.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f23d80e

Please sign in to comment.