title: R: invalid subscript type 'list'
body: <p>I'm trying to use the indices of a sorted column of a dataset.  I want to reorder the entire dataset by one sorted column.</p>
  
  <pre><code>area.sort&lt;-sort(xsample$area1, index.return=TRUE)[2]
  </code></pre>
  
  <p>The output is a list, so I can't use it index through the whole dataset.</p>
  
  <pre><code>Error in xj[i] : invalid subscript type 'list'
  </code></pre>
  
  <p>Someone suggested using unlist but I can't get rid of the <code>ix*</code>.
  Any ideas?  Thanks</p>
  
  <pre><code>&gt; area.sort&lt;-unlist(area.sort)
  
   ix1   ix2   ix3   ix4   ix5   ix6   ix7   ix8   ix9  ix10  ix11  ix12  ix13 
    45    96    92    80    53    54    24    21    63    81    40    66    64 
  </code></pre>