easystats / bayestestR

:ghost: Utilities for analyzing Bayesian models and posterior distributions
https://easystats.github.io/bayestestR/
GNU General Public License v3.0
575 stars 55 forks source link

cran checks #427

Closed DominiqueMakowski closed 3 years ago

DominiqueMakowski commented 3 years ago

https://win-builder.r-project.org/incoming_pretest/bayestestR_0.10.0_20210530_083839/Windows/00check.log https://win-builder.r-project.org/incoming_pretest/bayestestR_0.10.0_20210530_083839/Debian/00check.log

  == Failed tests ================================================================
  -- Failure (test-blavaan.R:77:5): blavaan, all ---------------------------------
  x$BF[2] < 1 is not TRUE

  `actual`:       
  `expected`: TRUE
  -- Failure (test-describe_posterior.R:26:5): describe_posterior ----------------
  colnames(rez) (`actual`) not equal to c(...) (`expected`).

  `actual[16:19]`:   "ROPE_high" "ROPE_Percentage" "ROPE_Equivalence" "log_BF"
  `expected[16:19]`: "ROPE_high" "ROPE_Percentage" "ROPE_Equivalence" "BF"    
  -- Error (test-emmGrid.R:199:5): emmGrid bayesfactor_parameters ----------------
  Error: non-numeric argument to mathematical function
  Backtrace:
      x
   1. \-testthat::expect_equal(log(xsdbf1$BF), log(xsdbf2$BF), tolerance = 0.1) test-emmGrid.R:199:4
   2.   \-testthat::quasi_label(enquo(object), label, arg = "object")
   3.     \-rlang::eval_bare(expr, quo_get_env(quo))

  [ FAIL 3 | WARN 19 | SKIP 11 | PASS 206 ]
  Error: Test failures
  Execution halted
strengejacke commented 3 years ago

Not sure, do we have x$BF, or x$log_BF? @mattansb

mattansb commented 3 years ago

Fixed (:

DominiqueMakowski commented 3 years ago

^^ did u forget to push?

mattansb commented 3 years ago

...

mattansb commented 3 years ago

No 🤪

DominiqueMakowski commented 3 years ago
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Failure (test-describe_posterior.R:26:5): describe_posterior ────────────────
  colnames(rez) (`actual`) not equal to c(...) (`expected`).

  `actual[16:19]`:   "ROPE_high" "ROPE_Percentage" "ROPE_Equivalence" "log_BF"
  `expected[16:19]`: "ROPE_high" "ROPE_Percentage" "ROPE_Equivalence" "BF"    

  [ FAIL 1 | WARN 16 | SKIP 11 | PASS 208 ]

lol that pesky change, will fix this

DominiqueMakowski commented 3 years ago

don't ask me why didn't it get catch locally 🤷

DominiqueMakowski commented 3 years ago

https://win-builder.r-project.org/incoming_pretest/bayestestR_0.10.0_20210530_110530/reverseDependencies/summary.txt

The log BF causes issues in the multifear package (and report):

Changes to worse in reverse depends:

Package: multifear
Check: examples
New result: ERROR
  Running examples in ‘multifear-Ex.R’ failed
  The error most likely occurred in:

  > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  > ### Name: rm_banova_mf
  > ### Title: rm_banova_mf
  > ### Aliases: rm_banova_mf
  > 
  > ### ** Examples
  > 
  > # Briefly define argument values that will be plugged in later on in the functions.
  > # We only use two trials as the function takes a long time to run.
  > 
  > cs1 <- paste0("CSP", 1:2)
  > cs2 <- paste0("CSM", 1:2)
  > subj <- "id"
  > 
  > # Bayesian Repeated measures ANOVA without groups
  > rm_banova_mf(cs1 = cs1, cs2 = cs2, subj = subj,
  + data = example_data, time = TRUE)
  Error: Can't subset columns that don't exist.
  ✖ Column `BF` doesn't exist.
  Backtrace:
       â–ˆ
    1. ├─multifear::rm_banova_mf(...)
    2. │ └─`%>%`(...)
    3. ├─dplyr::select(., BF)
    4. └─dplyr:::select.data.frame(., BF)
    5.   └─tidyselect::eval_select(expr(c(...)), .data)
    6.     └─tidyselect:::eval_select_impl(...)
    7.       ├─tidyselect:::with_subscript_errors(...)
    8.       │ ├─base::tryCatch(...)
    9.       │ │ └─base:::tryCatchList(expr, classes, parentenv, handlers)
   10.       │ │   └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
   11.       │ │     └─base:::doTryCatch(return(expr), name, parentenv, handler)
   12.       │ └─tidyselect:::instrument_base_errors(expr)
   13.       │   └─base::withCallingHandlers(...)
   14.       └─tidyselect:::vars_select_eval(...)
   15.         └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
   16.           └─tidyselect:::eval_c(expr, data_mask, context_mask)
   17.             └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
   18.               └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
   19.                 └─tidyselect:::as_indices_sel_impl(...)
   20.                   └─tidyselect:::as_indices_impl(x, vars, strict = strict)
   21.                     └─tidyselect:::chr_as_locations(x, vars)
   22.                       └─vctrs::vec_as_location(x, n = length(vars), names = vars)
   23.                         └─(function () ...
   24.                           └─vctrs:::stop_subscript_oob(...)
   25.                             └─vctrs:::stop_subscript(...)
  Execution halted

Package: multifear
Check: tests
New result: ERROR
    Running ‘testthat.R’ [37s/37s]
  Running the tests in ‘tests/testthat.R’ failed.
  Complete output:
    > library(testthat)
    > library(multifear)
    > 
    > test_check("multifear")
    ══ Failed tests ════════════════════════════════════════════════════════════════
    ── Error (test.output.R:47:3): rm_banova_mf works ──────────────────────────────
    Error: Can't subset columns that don't exist.
    ✖ Column `BF` doesn't exist.
    Backtrace:
         â–ˆ
      1. ├─testthat::expect_known_output(...) test.output.R:47:2
      2. │ ├─base::append(act, eval_with_output(object, print = print, width = width))
      3. │ └─testthat:::eval_with_output(object, print = print, width = width)
      4. │   ├─withr::with_output_sink(temp, withVisible(code))
      5. │   │ └─base::force(code)
      6. │   └─base::withVisible(code)
      7. ├─multifear::rm_banova_mf(cs1, cs2, subj = subj, data = example_data)
      8. │ └─`%>%`(...)
      9. ├─dplyr::select(., BF)
     10. └─dplyr:::select.data.frame(., BF)
     11.   └─tidyselect::eval_select(expr(c(...)), .data)
     12.     └─tidyselect:::eval_select_impl(...)
     13.       ├─tidyselect:::with_subscript_errors(...)
     14.       │ ├─base::tryCatch(...)
     15.       │ │ └─base:::tryCatchList(expr, classes, parentenv, handlers)
     16.       │ │   └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
     17.       │ │     └─base:::doTryCatch(return(expr), name, parentenv, handler)
     18.       │ └─tidyselect:::instrument_base_errors(expr)
     19.       │   └─base::withCallingHandlers(...)
     20.       └─tidyselect:::vars_select_eval(...)
     21.         └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
     22.           └─tidyselect:::eval_c(expr, data_mask, context_mask)
     23.             └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
     24.               └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
     25.                 └─tidyselect:::as_indices_sel_impl(...)
     26.                   └─tidyselect:::as_indices_impl(x, vars, strict = strict)
     27.                     └─tidyselect:::chr_as_locations(x, vars)
     28.                       └─vctrs::vec_as_location(x, n = length(vars), names = vars)
     29.                         └─(function () ...
     30.                           └─vctrs:::stop_subscript_oob(...)
     31.                             └─vctrs:::stop_subscript(...)
    ── Error (test.output.R:51:3): rm_banova_mf for groups works ───────────────────
    Error: Can't subset columns that don't exist.
    ✖ Column `BF` doesn't exist.
    Backtrace:
         â–ˆ
      1. ├─testthat::expect_known_output(...) test.output.R:51:2
      2. │ ├─base::append(act, eval_with_output(object, print = print, width = width))
      3. │ └─testthat:::eval_with_output(object, print = print, width = width)
      4. │   ├─withr::with_output_sink(temp, withVisible(code))
      5. │   │ └─base::force(code)
      6. │   └─base::withVisible(code)
      7. ├─multifear::rm_banova_mf(...)
      8. │ └─`%>%`(...)
      9. ├─dplyr::select(., BF)
     10. └─dplyr:::select.data.frame(., BF)
     11.   └─tidyselect::eval_select(expr(c(...)), .data)
     12.     └─tidyselect:::eval_select_impl(...)
     13.       ├─tidyselect:::with_subscript_errors(...)
     14.       │ ├─base::tryCatch(...)
     15.       │ │ └─base:::tryCatchList(expr, classes, parentenv, handlers)
     16.       │ │   └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
     17.       │ │     └─base:::doTryCatch(return(expr), name, parentenv, handler)
     18.       │ └─tidyselect:::instrument_base_errors(expr)
     19.       │   └─base::withCallingHandlers(...)
     20.       └─tidyselect:::vars_select_eval(...)
     21.         └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
     22.           └─tidyselect:::eval_c(expr, data_mask, context_mask)
     23.             └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
     24.               └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
     25.                 └─tidyselect:::as_indices_sel_impl(...)
     26.                   └─tidyselect:::as_indices_impl(x, vars, strict = strict)
     27.                     └─tidyselect:::chr_as_locations(x, vars)
     28.                       └─vctrs::vec_as_location(x, n = length(vars), names = vars)
     29.                         └─(function () ...
     30.                           └─vctrs:::stop_subscript_oob(...)
     31.                             └─vctrs:::stop_subscript(...)

    [ FAIL 2 | WARN 1 | SKIP 0 | PASS 15 ]
    Error: Test failures
    Execution halted

Package: report
Check: examples
New result: ERROR
  Running examples in ‘report-Ex.R’ failed
  The error most likely occurred in:

  > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  > ### Name: report.bayesfactor_models
  > ### Title: Reporting Models' Bayes Factor
  > ### Aliases: report.bayesfactor_models report.bayesfactor_inclusion
  > 
  > ### ** Examples
  > 
  > library(report)
  > 
  > mo0 <- lm(Sepal.Length ~ 1, data = iris)
  > mo1 <- lm(Sepal.Length ~ Species, data = iris)
  > mo2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris)
  > mo3 <- lm(Sepal.Length ~ Species * Petal.Length, data = iris)
  > 
  > if (require("bayestestR")) {
  +   # Bayes factor - models
  +   BFmodels <- bayesfactor_models(mo1, mo2, mo3, denominator = mo0)
  + 
  +   r <- report(BFmodels)
  +   r
  +   as.data.frame(r)
  + 
  +   # Bayes factor - inclusion
  +   inc_bf <- bayesfactor_inclusion(BFmodels, prior_odds = c(1, 2, 3), match_models = TRUE)
  + 
  +   r <- report(inc_bf)
  +   r
  +   as.data.frame(r)
  + }
  Loading required package: bayestestR
  Error in log(bf) : non-numeric argument to mathematical function
  Calls: report ... .report.bayesfactor_models -> paste0 -> paste0 -> <Anonymous>
  Execution halted

Package: report
Check: tests
New result: ERROR
    Running ‘spelling.R’ [0s/0s]
    Running ‘testthat.R’ [68s/68s]
  Running the tests in ‘tests/testthat.R’ failed.
  Complete output:
    > library(testthat)
    > library(report)
    > 
    > if (length(strsplit(packageDescription("report")$Version, "\\.")[[1]]) > 3) {
    +   Sys.setenv("RunAllreportTests" = "yes")
    + } else {
    +   Sys.setenv("RunAllreportTests" = "no")
    + }
    > 
    > osx <- tryCatch(
    +   {
    +     si <- Sys.info()
    +     if (!is.null(si["sysname"])) {
    +       si["sysname"] == "Darwin" || grepl("^darwin", R.version$os)
    +     } else {
    +       FALSE
    +     }
    +   },
    +   error = function(e) {
    +     FALSE
    +   }
    + )
    > 
    > test_check("report")
    Loading required package: lme4
    Loading required package: Matrix
    Loading required package: rstanarm
    Loading required package: Rcpp
    This is rstanarm version 2.21.1
    - See https://mc-stan.org/rstanarm/articles/priors for changes to default priors!
    - Default priors may change, so it's safest to specify priors, even if equivalent to the defaults.
    - For execution on a local, multicore CPU with excess RAM we recommend calling
      options(mc.cores = parallel::detectCores())
    For one-way between subjects designs, partial eta squared is equivalent to eta squared.
    Returning eta squared.
    Loading required package: bayestestR
    Loading required package: dplyr

    Attaching package: 'dplyr'

    The following object is masked from 'package:testthat':

        matches

    The following objects are masked from 'package:stats':

        filter, lag

    The following objects are masked from 'package:base':

        intersect, setdiff, setequal, union

    Loading required package: lavaan
    This is lavaan 0.6-8
    lavaan is FREE software! Please report any bugs.
    boundary (singular) fit: see ?isSingular
    ══ Skipped tests ═══════════════════════════════════════════════════════════════
    • On CRAN (11)

    ══ Failed tests ════════════════════════════════════════════════════════════════
    ── Error (test-report.bayesfactor_models.R:10:5): models ───────────────────────
    Error: non-numeric argument to mathematical function
    Backtrace:
        â–ˆ
     1. ├─report::report(BFmodels) test-report.bayesfactor_models.R:10:4
     2. └─report:::report.bayesfactor_models(BFmodels)
     3.   └─report:::.report.bayesfactor_models(...)
     4.     ├─base::paste0(...)
     5.     ├─base::paste0(...)
     6.     └─effectsize::interpret_bf(...)
    ── Error (test-report.bayesfactor_models.R:28:5): inclusion ────────────────────
    Error: non-numeric argument to mathematical function
    Backtrace:
        â–ˆ
     1. ├─report::report(inc_bf) test-report.bayesfactor_models.R:28:4
     2. └─report:::report.bayesfactor_inclusion(inc_bf)
     3.   └─report:::.report.bayesfactor_inclusion(...)
     4.     └─effectsize::interpret_bf(...)
strengejacke commented 3 years ago

Add back BF column and remove it in the print method?

DominiqueMakowski commented 3 years ago

https://github.com/AngelosPsy/multifear/issues/8

DominiqueMakowski commented 3 years ago

mmh it's weird to have both columns of essentially the same thing tho

mattansb commented 3 years ago

I say we wait to hear from @AngelosPsy first - see how easy of a fix it is for them.

I agree that having double columns is weird.......

strengejacke commented 3 years ago

How much time left for submission of modelbased?

DominiqueMakowski commented 3 years ago

I received no email asking me to update so 🤷

strengejacke commented 3 years ago

ok, probably it was statsExpressions 😄 But you will, too: https://cran.r-project.org/web/checks/check_results_modelbased.html

strengejacke commented 3 years ago

remember to fix https://github.com/easystats/easystats/issues/139#issuecomment-845712379 in report before submitting an update.

DominiqueMakowski commented 3 years ago

remember to fix easystats/easystats#139 (comment) in report before submitting an update.

pinging also vice-maintainer @IndrajeetPatil in case I forget ^^

AngelosPsy commented 3 years ago

Hello @danielskatz & @mattansb . Thank you for the heads up, I appreciate it! OK, so I think it is easy to fix and I will cut a new release once your updated package is accepted on CRAN. Is that with you?

DominiqueMakowski commented 3 years ago

Great @AngelosPsy and thanks, I'll the CRAN team know that all is in order then :)

IndrajeetPatil commented 3 years ago

pinging also vice-maintainer @IndrajeetPatil in case I forget ^^

I had already fixed this on GitHub! 💪 https://github.com/easystats/report/commit/4e97cb54069cea961158a29ec63249b71310dd2d

DominiqueMakowski commented 3 years ago
Thanks, on its way to CRAN.

Team, this breaks multifear and report.

Best,