knitr::opts_chunk$set(
  fig.path = "man/figures/",
  comment = NA
)

R build status Codecov test coverage Lifecycle: maturing

confusionMatrix


Given predictions and a target variable, provide numerous statistics from the resulting confusion matrix. The goal is to provide a wealth of summary statistics that can be calculated from a single confusion matrix, and return tidy results with as few dependencies as possible.

library(confusionMatrix)

p = sample(letters[1:2], 250, replace = T, prob = 1:2)
o = sample(letters[1:2], 250, replace = T, prob = 1:2)

result = confusion_matrix(
  prediction = p,
  target = o,
  return_table = TRUE
)

result

result$Accuracy$`Frequency Table`
result = confusion_matrix(
  prediction = p,
  target = o,
  longer = TRUE
)

result

Installation

To install from GitHub the devtools package is required.

devtools::install_github('m-clark/confusionMatrix')


m-clark/confusionMatrix documentation built on July 15, 2020, 4:16 p.m.