Get names of dimnames matching value
<p>I'm trying to get dimnames couple from a matrix selection.</p>

<pre><code>names&lt;-c("n1", "n2", "n3")
mat&lt;-matrix(0, nrow=length(names), ncol=length(names), dimnames=list(names, names))
mat[1,2]&lt;-3
mat[3,2]&lt;-6
mat
</code></pre>

<p>Output is :</p>

<pre><code>   n1 n2 n3
n1  0  3  0
n2  0  0  0
n3  0  6  0
</code></pre>

<p>I would like to get all the couples greater than 0 :</p>

<pre><code>n1,n2
n2,n3
</code></pre>

<p>The use of rownames and colnames give me NULL.</p>