Skip to content
Prev 243324 / 398500 Next

selecting only corresponding categories from a confusion matrix

On Nov 29, 2010, at 8:32 AM, drflxms wrote:

            
I wasn't able to follow the confusing, er, confusion matrix  
explanation but it appears from a comparison of the input and output  
that you just want row indices that are the  column names:

 > mtx[colnames(mtx), ]
        0  1 1001 1010 11
0    609 11   54   36  6
1      1  2    6    0  2
1001   0  0    4    0  0
1010   4  0    0    3  0
11     0  0    3    3  1
 >
 > # and the omitted
 >
 > mtx[!rownames(mtx) %in% colnames(mtx), ]
       0 1 1001 1010 11
10   14 0    0    8  4
100   4 0    0    0  0
1000 23 7   12   10  5
1011  1 0    1    0  2
110   1 0    0    0  0
1100  2 0    0    0  0
1110  1 0    0    0  0
 >
 > # and their number:
 >
 > NROW(mtx[!rownames(mtx) %in% colnames(mtx), ])
[1] 7
David Winsemius, MD
West Hartford, CT