Running examples in ‘broom-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: tidy.confusionMatrix
> ### Title: Tidy a(n) confusionMatrix object
> ### Aliases: tidy.confusionMatrix caret_tidiers confusionMatrix_tidiers
> 
> ### ** Examples
> 
> 
> if (requireNamespace("caret", quietly = TRUE)) {
+ 
+   set.seed(27)
+   
+   two_class_sample1 <- as.factor(sample(letters[1:2], 100, TRUE))
+   two_class_sample2 <- as.factor(sample(letters[1:2], 100, TRUE))
+   
+   two_class_cm <- caret::confusionMatrix(
+     two_class_sample1,
+     two_class_sample2
+   )
+   
+   tidy(two_class_cm)
+   tidy(two_class_cm, by_class = FALSE)
+   
+   # multiclass example
+   
+   six_class_sample1 <- as.factor(sample(letters[1:6], 100, TRUE))
+   six_class_sample2 <- as.factor(sample(letters[1:6], 100, TRUE))
+   
+   six_class_cm <- caret::confusionMatrix(
+     six_class_sample1,
+     six_class_sample2
+   )
+   
+   tidy(six_class_cm)
+   tidy(six_class_cm, by_class = FALSE)
+ }
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
broom
 --- call from context --- 
tidy.confusionMatrix(six_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(six_class_cm)
where 2: tidy(six_class_cm)

 --- 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: 0x557a67860f98>
<environment: namespace:broom>
 --- function search by body ---
Function tidy.confusionMatrix in namespace broom has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1