title: How do I retrieve a matrix column and row name by a matrix index value?
body: <p>So let's say I have a matrix, mdat and I only know the index number. How do I retrieve the column and row names? For example:</p>
  
  <pre><code>&gt; mdat &lt;- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE, 
      dimnames = list(c("row1", "row2"), c("C.1", "C.2", "C.3"))) 
  &gt; mdat[4] 
  [1] 12 
  &gt; names(mdat[4]) 
  NULL 
  &gt; colnames(mdat[4]) 
  NULL 
  &gt; rownames(mdat[4])
  NULL 
  &gt; dimnames(mdat[4]) 
  NULL 
  </code></pre>