title: How to sort a list of lists in R?
body: <p>I am attempting to sort a list of lists in R. Each sublist contains an integer and a character string. My goal is to order the lists such that the final list is sorted by the integers in ascending order. Below is an example of what I am trying to accomplish:</p>
  
  <pre><code>a &lt;- list(-5,"help")
  b &lt;- list(3, "stack")
  c &lt;- list(1, "me")
  d &lt;- list(10, "overflow")
  
  list.of.lists &lt;- list(a,b,c,d)
  magic.sort(list.of.lists)
  # Below is not exactly how it would be displayed, but should be understandable
  -5, "help"
  1, "me"
  3, "stack"
  10, "overflow"
  </code></pre>
  
  <p>Is there a nice way within R to achieve this result? Ideally the result should be returned as a list of lists as well.</p>