Running 'test-all.R' [44s/54s]
Running the tests in 'tests/test-all.R' failed.
Complete output:
  > library(testthat)
  > test_check("broom")
  Loading required package: broom
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  broom
   --- call from context --- 
  tidy.confusionMatrix(multi_class_cm)
   --- call from argument --- 
  if (class(x$byClass) != "matrix") {
      classes <- x$byClass %>% as.data.frame() %>% rename_at(1, 
          ~"value") %>% tibble::rownames_to_column("var") %>% mutate(var = stringr::str_to_lower(gsub(" ", 
          "_", var)))
      terms <- c(nms_cm, classes$var)
      class <- c(rep(NA_character_, 2), rep(x$positive, length(terms) - 
          2))
      estimates <- c(cm$Accuracy, cm$Kappa, classes$value)
      conf.low <- c(cm$AccuracyLower, rep(NA, length(terms) - 1))
      conf.high <- c(cm$AccuracyUpper, rep(NA, length(terms) - 
          1))
      p.value <- c(cm$AccuracyPValue, cm$McnemarPValue, rep(NA, 
          length(terms) - 2))
  } else {
      classes <- x$byClass %>% as.data.frame() %>% tibble::rownames_to_column("class") %>% 
          gather(var, value, -class) %>% mutate(var = stringr::str_to_lower(gsub(" ", 
          "_", var)), class = gsub("Class: ", "", class))
      terms <- c(nms_cm, classes$var)
      class <- c(rep(NA_character_, 2), classes$class)
      estimates <- c(cm$Accuracy, cm$Kappa, classes$value)
      conf.low <- c(cm$AccuracyLower, rep(NA, length(terms) - 1))
      conf.high <- c(cm$AccuracyUpper, rep(NA, length(terms) - 
          1))
      p.value <- c(cm$AccuracyPValue, cm$McnemarPValue, rep(NA, 
          length(terms) - 2))
  }
   --- R stacktrace ---
  where 1: tidy.confusionMatrix(multi_class_cm)
  where 2 at testthat/test-caret.R#32: tidy(multi_class_cm)
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: 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 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: 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 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-caret.R#5: test_that("tidy.confusionMatrix", {
      check_arguments(tidy.confusionMatrix)
      set.seed(28)
      two_class_sample1 <- factor(rbinom(100, 1, 0.5))
      two_class_sample2 <- factor(rbinom(100, 1, 0.5))
      multi_class_sample1 <- factor(rbinom(100, 4, 0.5))
      multi_class_sample2 <- factor(rbinom(100, 4, 0.5))
      two_class_cm <- caret::confusionMatrix(two_class_sample1, 
          two_class_sample2)
      multi_class_cm <- caret::confusionMatrix(multi_class_sample1, 
          multi_class_sample2)
      td_2c_by_class <- tidy(two_class_cm)
      td_2c <- tidy(two_class_cm, by_class = FALSE)
      check_tidy_output(td_2c_by_class)
      check_tidy_output(td_2c)
      td_mc_by_class <- tidy(multi_class_cm)
      td_mc <- tidy(multi_class_cm, by_class = FALSE)
      check_tidy_output(td_mc_by_class)
      check_tidy_output(td_mc)
  })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: 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 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: 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 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: 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 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: 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 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: 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 41: 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 42: test_check("broom")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, by_class = TRUE, ...) 
  {
      cm <- as.list(x$overall)
      nms_cm <- stringr::str_to_lower(names(cm)[1:2])
      if (by_class) {
          if (class(x$byClass) != "matrix") {
              classes <- x$byClass %>% as.data.frame() %>% rename_at(1, 
                  ~"value") %>% tibble::rownames_to_column("var") %>% 
                  mutate(var = stringr::str_to_lower(gsub(" ", 
                    "_", var)))
              terms <- c(nms_cm, classes$var)
              class <- c(rep(NA_character_, 2), rep(x$positive, 
                  length(terms) - 2))
              estimates <- c(cm$Accuracy, cm$Kappa, classes$value)
              conf.low <- c(cm$AccuracyLower, rep(NA, length(terms) - 
                  1))
              conf.high <- c(cm$AccuracyUpper, rep(NA, length(terms) - 
                  1))
              p.value <- c(cm$AccuracyPValue, cm$McnemarPValue, 
                  rep(NA, length(terms) - 2))
          }
          else {
              classes <- x$byClass %>% as.data.frame() %>% tibble::rownames_to_column("class") %>% 
                  gather(var, value, -class) %>% mutate(var = stringr::str_to_lower(gsub(" ", 
                  "_", var)), class = gsub("Class: ", "", class))
              terms <- c(nms_cm, classes$var)
              class <- c(rep(NA_character_, 2), classes$class)
              estimates <- c(cm$Accuracy, cm$Kappa, classes$value)
              conf.low <- c(cm$AccuracyLower, rep(NA, length(terms) - 
                  1))
              conf.high <- c(cm$AccuracyUpper, rep(NA, length(terms) - 
                  1))
              p.value <- c(cm$AccuracyPValue, cm$McnemarPValue, 
                  rep(NA, length(terms) - 2))
          }
          df <- tibble(term = terms, class = class, estimate = estimates, 
              conf.low = conf.low, conf.high = conf.high, p.value = p.value)
      }
      else {
          terms <- c(nms_cm)
          estimates <- c(cm$Accuracy, cm$Kappa)
          conf.low <- c(cm$AccuracyLower, NA)
          conf.high <- c(cm$AccuracyUpper, NA)
          p.value <- c(cm$AccuracyPValue, cm$McnemarPValue)
          df <- tibble(term = terms, estimate = estimates, conf.low = conf.low, 
              conf.high = conf.high, p.value = p.value)
      }
      fix_data_frame(df)
  }
  <bytecode: 0x2986528>
  <environment: namespace:broom>
   --- function search by body ---
  Function tidy.confusionMatrix in namespace broom has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 1. Error: tidy.confusionMatrix (@test-caret.R#32)  --------------------------
  the condition has length > 1
  Backtrace:
   1. generics::tidy(multi_class_cm)
   2. broom:::tidy.confusionMatrix(multi_class_cm)
  
  == testthat results  ===========================================================
  [ OK: 884 | SKIPPED: 2 | WARNINGS: 34 | FAILED: 1 ]
  1. Error: tidy.confusionMatrix (@test-caret.R#32) 
  
  Error: testthat unit tests failed
  Execution halted