title: Select column and row values with an index in data frame
body: <p>I have a matrix of correlations, and I am trying to keep the maximum value (considering absolute values) of each pair (row/column). I wanted to ask, how to extract the values if I have the index of the position with the specific max. value. 
  This is my sample:</p>
  
  <pre><code>mat &lt;- structure(c(0, 0.428291512801413, 0.124436112431533,    -0.345870125921382, 
               0.391613957773281, 0.428291512801413, 0, 0.341415068127906, -0.346724601510298, 
               0.486360835614514, 0.124436112431533, 0.341415068127906, 0, -0.496213980990412, 
               0.41819049956841, -0.345870125921382, -0.346724601510298, -0.496213980990412, 
               0, -0.80231408836218, 0.391613957773281, 0.486360835614514, 0.41819049956841, 
              -0.80231408836218, 0), .Dim = c(5L, 5L), .Dimnames = list(c("LO3","Tx", "Gh", "RH", "SR"), c("LO3", "Tx", "Gh", "RH", "SR"))) 
  </code></pre>
  
  <p>Then, I am taking the index of maximum value:</p>
  
  <pre><code>ind &lt;- apply(abs(mat), 2, which.max) 
  </code></pre>
  
  <p>which gives me:</p>
  
  <pre><code>LO3  Tx  Gh  RH  SR 
  2   5   4   5   4
  </code></pre>
  
  <p>What I wanted now, it's getting the value of these position for each column ..
  which would be: </p>
  
  <pre><code>LO3       Tx        Gh
  0.4282915 0.4863608  -0.4962140 .....
  </code></pre>
  
  <p>I tried to use <code>apply</code>, but I don't know how to do it..or if there would be another way to do that.</p>