<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: collapse; font-family: 'Open Sans'; font-size: 13px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">Dear all, <br>I am looking for a workaround to select rows and cols of a matrix. <br>I want to select all rows which have a value higher than a threshold. <br><br>If i create my matrix with <br><br><br>m <- matrix(1:12,3,4) <br>I get <br> [,1] [,2] [,3] [,4] <br>[1,] 1 4 7 10 <br>[2,] 2 5 8 11 <br>[3,] 3 6 9 12 <br><br>Let's give the matrix rownames with <br>rownames(m) <- c("M1", "M2", "M3") <br><br>I get my matrix <br><br> [,1] [,2] [,3] [,4] <br>M1 1 4 7 10 <br>M2 2 5 8 11 <br>M3 3 6 9 12 <br><br>No I want to select the rownames of m which have a value higher than 7 in a row <br><br>I tried <br>m[apply(m, 1, function(x) any(x > 7)),] <br><br>but the return was the whole matrix. So it was not possible for me to get the two last columns.... <br><br>Is there any easy way to get the index or rowname of a matrix which have an entry with a chosen threshold? <br><br>Would be nice if anybody can help me out. <br><br>All the best <br>Peter</span></body></html>