With R: If I have a square matrix, what would be the easiest(as well as fast) way to delete the row and column if the value on the diagonal is less than five? For example
x1 x2 x3 x4
x1 13 15 12 25
x2 23 4 23 34
x3 21 11 1 11
x4 11 22 23 33
The code would delete row 2 and column 2, and row 3 and column 3. I tried doing for(i in 1:nrow(Mx)), but deleting rows changes the total number of rows.
The final matrix would look like
x1 x4
x1 13 25
x4 11 33