bbolker / broom.mixed

tidy methods for mixed models in R
227 stars 23 forks source link

R CMD check fails if some suggested packages are missing #131

Closed bizzinho closed 1 year ago

bizzinho commented 1 year ago

Confirmed for versions v0.2.7 (original observation) and v0.2.9.4 with R 4.1.0 on RHEL.

Trying to run R CMD check on {broom.mixed} after installing only Imports, Depends, LinkingTo packages results in an error during tests. I don't think it's a major issue, but maybe the handling in the tests can be improved so that there is no attempt to use objects lmm0, lmm1, etc when they are not around. Here is the .Rout.fail:


R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> Sys.setenv("R_TESTS" = "")
> library(testthat)
> test_check("broom.mixed")
Loading required package: broom.mixed
[ FAIL 4 | WARN 11 | SKIP 0 | PASS 83 ]

══ Failed tests ════════════════════════════════════════════════════════════════
── Error (test-lme4.R:183:6): tidy respects conf.level ─────────────────────────
Error in `tidy(lmm0, conf.int = TRUE, conf.level = cl)`: object 'lmm0' not found
Backtrace:
    ▆
 1. ├─testthat::expect_equal(tmpf(), 232.3019, tolerance = 1e-04) at test-lme4.R:183:5
 2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
 3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
 4. └─broom.mixed (local) tmpf()
 5.   └─generics::tidy(lmm0, conf.int = TRUE, conf.level = cl) at test-lme4.R:181:9
── Error (test-lme4.R:188:5): effects='ran_pars' + conf.int works ──────────────
Error in `tidy(lmm0, effects = "ran_pars", conf.int = TRUE, conf.method = "profile", 
    quiet = TRUE)`: object 'lmm0' not found
Backtrace:
    ▆
 1. └─generics::tidy(...) at test-lme4.R:188:4
── Error (test-lme4.R:206:5): augment returns a tibble ─────────────────────────
Error in `augment(fit)`: object 'fit' not found
Backtrace:
    ▆
 1. ├─testthat::expect_is(augment(fit), "tbl") at test-lme4.R:206:4
 2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
 3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
 4. └─generics::augment(fit)
── Error (test-lme4.R:211:5): conf intervals for ranef in correct order ────────
Error in `tidy(lmm1, conf.int = TRUE, effect = "ran_pars", conf.method = "profile", 
    quiet = TRUE)`: object 'lmm1' not found
Backtrace:
    ▆
 1. └─generics::tidy(...) at test-lme4.R:211:4

[ FAIL 4 | WARN 11 | SKIP 0 | PASS 83 ]
Error: Test failures
Execution halted

and here the relevant excerpts from 00check.log

* this is package ‘broom.mixed’ version ‘0.2.9.4’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... WARNING
Skipping vignette re-building
Packages suggested but not available for checking:
  'brms', 'dotwhisker', 'knitr', 'gamlss', 'gamlss.data',
  'GLMMadaptive', 'glmmADMB', 'glmmTMB', 'lmerTest', 'lme4',
  'MCMCglmm', 'pander', 'pbkrtest', 'rstan', 'rstanarm', 'rstantools',
  'R2jags', 'TMB', 'rmarkdown'

(...)

* checking tests ... ERROR
  Running ‘test-all.R’
Running the tests in ‘tests/test-all.R’ failed.
Last 13 lines of output:
      ▆
   1. ├─testthat::expect_is(augment(fit), "tbl") at test-lme4.R:206:4
   2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─generics::augment(fit)
  ── Error (test-lme4.R:211:5): conf intervals for ranef in correct order ────────
  Error in `tidy(lmm1, conf.int = TRUE, effect = "ran_pars", conf.method = "profile", 
      quiet = TRUE)`: object 'lmm1' not found
  Backtrace:
      ▆
   1. └─generics::tidy(...) at test-lme4.R:211:4

  [ FAIL 4 | WARN 11 | SKIP 0 | PASS 83 ]
  Error: Test failures
  Execution halted
* checking PDF version of manual ... OK
* DONE
Status: 1 ERROR, 1 WARNING, 1 NOTE
bbolker commented 1 year ago

This looks like it was a single misplaced bracket. Pull and try again?

bbolker commented 1 year ago

Closing, happy to reopen if necessary