Convert confusion matrices and tables to frequency matrices

as.frequency.matrix(confusion_matrix)

Arguments

confusion_matrix

a matrix or table object that can be assumed to be a confusion matrix.

Value

a frequency matrix normalizing by the column total (expresed as percentages)

Examples

table(1:3, 3:1)
#> #> 1 2 3 #> 1 0 0 1 #> 2 0 1 0 #> 3 1 0 0
# 1 2 3 # 1 0 0 1 # 2 0 1 0 # 3 1 0 0 as.frequency.matrix(table(1:3, 3:1))
#> #> 1 2 3 #> 1 0 0 100 #> 2 0 100 0 #> 3 100 0 0
# # 1 2 3 # 1 0 0 100 # 2 0 100 0 # 3 100 0 0 as.frequency.matrix(table(c(3,3,2), 3:1))
#> #> 1 2 3 #> 2 100 0 0 #> 3 0 100 100
# # 2 3 # 1 100 0 # 2 0 100 # 3 0 100