Running ‘testthat.R’ [26s/93s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(jmv)
  > 
  > test_check("jmv")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  jmv
   --- call from context --- 
  NULL
   --- call from argument --- 
  if (class(CI[[i]]) == "try-error") CI[[i]] <- confint.default(models[[i]], 
      level = self$options$ciWidth/100)
   --- R stacktrace ---
  where 1: withCallingHandlers(expr, message = function(c) invokeRestart("muffleMessage"))
  where 2: suppressMessages({
      models <- list()
      modelTest <- list()
      lrTestTerms <- list()
      dev <- list()
      AIC <- list()
      BIC <- list()
      pseudoR <- list()
      CI <- list()
      CIOR <- list()
      nullFormula <- as.formula(paste0(jmvcore::toB64(self$options$dep), 
          "~ 1"))
      nullModel <- MASS::polr(nullFormula, data = data, model = TRUE, 
          Hess = TRUE)
      null <- list(dev = nullModel$deviance, df = nullModel$edf)
      for (i in seq_along(formulas)) {
          models[[i]] <- MASS::polr(formulas[[i]], data = data, 
              model = TRUE, Hess = TRUE)
          models[[i]]$call$formula <- formulas[[i]]
          lrTestTerms[[i]] <- car::Anova(models[[i]], test = "LR", 
              type = 3, singular.ok = TRUE)
          modelTest[[i]] <- private$.modelTest(models[[i]], null)
          dev[[i]] <- models[[i]]$deviance
          AIC[[i]] <- stats::AIC(models[[i]])
          BIC[[i]] <- stats::BIC(models[[i]])
          pseudoR[[i]] <- private$.pseudoR2(models[[i]], null)
          CI[[i]] <- try(confint(models[[i]], level = self$options$ciWidth/100), 
              silent = TRUE)
          if (class(CI[[i]]) == "try-error") 
              CI[[i]] <- confint.default(models[[i]], level = self$options$ciWidth/100)
          CILO <- try(confint(models[[i]], level = self$options$ciWidthOR/100), 
              silent = TRUE)
          if (class(CILO[[i]]) == "try-error") 
              CILO <- confint.default(models[[i]], level = self$options$ciWidthOR/100)
          CIOR[[i]] <- exp(CILO)
      }
      if (length(formulas) > 1) 
          lrTest <- do.call(stats::anova, c(models, test = "Chisq"))
      else lrTest <- NULL
  })
  where 3: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
  where 4: suppressWarnings({
      suppressMessages({
          models <- list()
          modelTest <- list()
          lrTestTerms <- list()
          dev <- list()
          AIC <- list()
          BIC <- list()
          pseudoR <- list()
          CI <- list()
          CIOR <- list()
          nullFormula <- as.formula(paste0(jmvcore::toB64(self$options$dep), 
              "~ 1"))
          nullModel <- MASS::polr(nullFormula, data = data, model = TRUE, 
              Hess = TRUE)
          null <- list(dev = nullModel$deviance, df = nullModel$edf)
          for (i in seq_along(formulas)) {
              models[[i]] <- MASS::polr(formulas[[i]], data = data, 
                  model = TRUE, Hess = TRUE)
              models[[i]]$call$formula <- formulas[[i]]
              lrTestTerms[[i]] <- car::Anova(models[[i]], test = "LR", 
                  type = 3, singular.ok = TRUE)
              modelTest[[i]] <- private$.modelTest(models[[i]], 
                  null)
              dev[[i]] <- models[[i]]$deviance
              AIC[[i]] <- stats::AIC(models[[i]])
              BIC[[i]] <- stats::BIC(models[[i]])
              pseudoR[[i]] <- private$.pseudoR2(models[[i]], null)
              CI[[i]] <- try(confint(models[[i]], level = self$options$ciWidth/100), 
                  silent = TRUE)
              if (class(CI[[i]]) == "try-error") 
                  CI[[i]] <- confint.default(models[[i]], level = self$options$ciWidth/100)
              CILO <- try(confint(models[[i]], level = self$options$ciWidthOR/100), 
                  silent = TRUE)
              if (class(CILO[[i]]) == "try-error") 
                  CILO <- confint.default(models[[i]], level = self$options$ciWidthOR/100)
              CIOR[[i]] <- exp(CILO)
          }
          if (length(formulas) > 1) 
              lrTest <- do.call(stats::anova, c(models, test = "Chisq"))
          else lrTest <- NULL
      })
  })
  where 5: private$.compute(data)
  where 6: private$.run()
  where 7: eval(expr)
  where 8: try({
      result <- private$.run()
      for (addon in private$.addons) {
          private$.checkpoint()
          addon$.__enclos_env__$private$.run()
      }
  }, silent = TRUE)
  where 9: analysis$run()
  where 10 at testthat/testlogregord.R#13: jmv::logRegOrd(data = df, dep = "y", covs = c("x1", "x2"), blocks = list(list("x1", 
      "x2")))
  where 11: eval(code, test_env)
  where 12: eval(code, test_env)
  where 13: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 14: doTryCatch(return(expr), name, parentenv, handler)
  where 15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 16: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 19: tryCatchList(expr, classes, parentenv, handlers)
  where 20: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 21: test_code(desc, code, env = parent.frame())
  where 22 at testthat/testlogregord.R#3: test_that("logregord works", {
      set.seed(1337)
      y <- factor(sample(1:3, 100, replace = TRUE))
      x1 <- rnorm(100)
      x2 <- rnorm(100)
      df <- data.frame(y = y, x1 = x1, x2 = x2)
      logReg <- jmv::logRegOrd(data = df, dep = "y", covs = c("x1", 
          "x2"), blocks = list(list("x1", "x2")))
      modelFit <- logReg$modelFit$asDF
      coef <- logReg$models[[1]]$coef$asDF
      expect_equal(0.000568, modelFit$r2mf[1], tolerance = 1e-06)
      expect_equal(217.779, modelFit$dev[1], tolerance = 0.001)
      expect_equal(0.058, coef$est[1], tolerance = 0.001)
      expect_equal(0.172, coef$se[2], tolerance = 0.001)
      expect_equal(0.848, coef$p[2], tolerance = 0.001)
  })
  where 23: eval(code, test_env)
  where 24: eval(code, test_env)
  where 25: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 26: doTryCatch(return(expr), name, parentenv, handler)
  where 27: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 28: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 29: doTryCatch(return(expr), name, parentenv, handler)
  where 30: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 31: tryCatchList(expr, classes, parentenv, handlers)
  where 32: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 33: test_code(NULL, exprs, env)
  where 34: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 35: force(code)
  where 36: doWithOneRestart(return(expr), restart)
  where 37: withOneRestart(expr, restarts[[1L]])
  where 38: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 39: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 40: FUN(X[[i]], ...)
  where 41: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 42: force(code)
  where 43: doWithOneRestart(return(expr), restart)
  where 44: withOneRestart(expr, restarts[[1L]])
  where 45: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 46: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 47: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 48: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 49: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 50: test_check("jmv")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
   --- function search by body ---
   ----------- END OF FAILURE REPORT -------------- 
  ── 1. Error: logregord works (@testlogregord.R#13)  ────────────────────────────
  the condition has length > 1
  Backtrace:
    1. jmv::logRegOrd(...)
    2. analysis$run()
    5. private$.run()
    6. private$.compute(data)
    9. base::suppressMessages(...)
   10. base::withCallingHandlers(expr, message = function(c) invokeRestart("muffleMessage"))
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  [ OK: 145 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 1 ]
  1. Error: logregord works (@testlogregord.R#13) 
  
  Error: testthat unit tests failed
  Execution halted