Saving output of confusionMatrix as a .csv table
问题 I have a following code resulting in a table-like output 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) library(caret) confusionMatrix(xtab) confusionMatrix(pred, truth) confusionMatrix(xtab, prevalence = 0.25) I would like to export the below part of the output as a .csv table Accuracy : 0.8285 95% CI : (0.7844, 0.8668)