I am looking at model comparison where I have calculated several different confusion matricies built with the ROCR package. They are currently in a form like a_cm, b_cm, c_cm.... etc
I can get the accuracy of the confusion matrix by selecting:
a_cm_accuracy <- a_cm$overall[1]
What i'd like to do is something like
confusion_matricies <- c(a_cm, b_cm, c_cm, d_cm, e_cm, f_cm, g_cm)
accuracy <- lapply(confusion_matricies, function(x) x['overall'][1])
But I know that won't work and just returns null. I tried this as well to get the first element by each variable but need to go a level down and not quite sure how:
test_apply2 <- lapply(confusion_matricies,"[",1)
If I could just get a list of the accuracy statistics that would loop through a list of these that would be great. Thanks!