title: R, extracting value from one attribute based on another attribute
body: <p>I've run some analysis that outputs data in the following format:</p>
  <pre><code>&gt; sft
     Power SFT.R.sq   slope truncated.R.sq mean.k. median.k. max.k.
  1      1  0.35400  8.4300         0.7710  146.00    145.00  166.0
  2      2  0.21900  2.2500         0.8960   83.30     82.80  107.0
  3      3  0.17300  1.1600         0.9310   49.90     49.80   72.0
  4      4  0.04100  0.3070         0.7360   31.60     31.20   50.3
  5      5  0.00165 -0.0298         0.4610   21.30     21.00   37.3
  6      6  0.05310 -0.1780        -0.1240   15.30     14.60   28.9
  7      7  0.21300 -0.2610        -0.0113   11.60     10.90   24.0
  8      8  0.63800 -0.5280         0.5560    9.27      8.18   22.3
  9      9  0.82500 -0.6310         0.8110    7.69      6.14   21.2
  10    10  0.85000 -0.7400         0.8100    6.59      4.97   20.3
  11    11  0.82200 -0.8310         0.7710    5.77      3.95   19.6
  12    12  0.81900 -0.8480         0.7680    5.16      3.27   19.0
  13    13  0.73300 -0.8670         0.6660    4.67      2.80   18.4
  14    14  0.65300 -0.9170         0.5840    4.28      2.39   17.9
  15    15  0.70200 -0.9130         0.6440    3.97      2.22   17.4
  </code></pre>
  <p>What I want is to extract the Power that gave the highest (maximum) SFT.R.sq value.</p>
  <p>Here is the table's attributes:</p>
  <pre><code>&gt;str(sft)
  List of 2
   $ powerEstimate: int NA
   $ fitIndices   :'data.frame':  15 obs. of  7 variables:
    ..$ Power         : int [1:15] 1 2 3 4 5 6 7 8 9 10 ...
    ..$ SFT.R.sq      : num [1:15] 0.35392 0.21883 0.17291 0.04098 0.00165 ...
    ..$ slope         : num [1:15] 8.4267 2.2461 1.158 0.307 -0.0298 ...
    ..$ truncated.R.sq: num [1:15] 0.771 0.896 0.931 0.736 0.461 ...
    ..$ mean.k.       : num [1:15] 145.8 83.3 49.9 31.6 21.3 ...
    ..$ median.k.     : num [1:15] 145.1 82.8 49.8 31.2 21 ...
    ..$ max.k.        : num [1:15] 165.6 107.1 72 50.3 37.3 ...
  </code></pre>
  <p>I can grab the two columns I need easily with:</p>
  <pre><code>sft$fitIndices$Power
  sft$fitIndices$SFT.R.sq
  </code></pre>
  <p>But I can't get the actual power associated with the highest SFT.R.sq value:</p>
  <pre><code>&gt;sft$fitIndices$Power[max(sft$fitIndices$SFT.R.sq)]
  integer(0)
  </code></pre>
  <p>Examples of what I'm trying to do usually involve dataframes where you extract a value based on the value from another column - but it doesn't seem to work with attributes.</p>