as.table.confusionMatrix

0th

Percentile

Save Confusion Table Results

Conversion functions for class confusionMatrix

Keywords
utilities
Usage
"as.matrix"(x, what = "xtabs", ...)
"as.table"(x, ...)
Arguments
x
an object of class confusionMatrix
what
data to conver to matrix. Either "xtabs", "overall" or "classes"
...
not currently used
Details

For as.table, the cross-tabulations are saved. For as.matrix, the three object types are saved in matrix format.

Value

A matrix or table

See Also

confusionMatrix

Aliases
  • as.table.confusionMatrix
  • as.matrix.confusionMatrix
Examples
###################
## 2 class example

lvs <- c("normal", "abnormal")
truth <- factor(rep(lvs, times = c(86, 258)),
                levels = rev(lvs))
pred <- factor(
               c(
                 rep(lvs, times = c(54, 32)),
                 rep(lvs, times = c(27, 231))),               
               levels = rev(lvs))

xtab <- table(pred, truth)

results <- confusionMatrix(xtab)
as.table(results)
as.matrix(results)
as.matrix(results, what = "overall")
as.matrix(results, what = "classes")
  
###################
## 3 class example

xtab <- confusionMatrix(iris$Species, sample(iris$Species))
as.matrix(xtab)
Documentation reproduced from package caret, version 6.0-70, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.