title: Sort list of lists by length of member lists
body: <p>I have output from a package (apcluster) that comes as a S4 object type. One of the members is a list of lists determining the members of each cluster found. I want to sort that list by the length (largest clusters).</p>
  
  <p>My code right now looks like</p>
  
  <pre><code>ap.result &lt;- apcluster(args)
  clusters &lt;- ap.result@cluster #list of lists
  </code></pre>
  
  <p>I can then access individual members of <code>clusters</code> by <code>clusters[[i]]</code> but the order is semi-random. If I <code>unlist(clusters)</code> then I get a vector without knowing which sub-list it came from.</p>
  
  <p>How can I sort <code>ap.result@cluster</code> to be ordered by longest member list to shortest member list?</p>