confusion_table = table(actuals, predicted_values)
print(confusion_table)
predicted_values
actuals 0 1
0 102 110
1 48 440
I want to flip the order of confusion matrix .i.e 1,0 in rows and columns
predicted
expected output actuals 1 0
1
0
How do I change this?
Reverse the order of the rows and columns
table(0:1, 0:1)
#
# 0 1
# 0 1 0
# 1 0 1
table(0:1, 0:1)[2:1, 2:1]
#
# 1 0
# 1 1 0
# 0 0 1
So on your data, try
table(actuals, predicted_values)[2:1, 2:1]