title: Find minimum of List of Lists in R
body: <p>I have a list of lists. I want to get the <code>order_number</code> with the smallest <code>distance</code>. </p>
  
  <p>Here's my list of lists.</p>
  
  <pre><code>d &lt;- list( list(distance = 450, order_number = 12), 
  list(distance = 930, order_number = 99), 
  list(distance = 100, order_number = 34))
  </code></pre>
  
  <p>The <code>order_number</code> with the smallest <code>distance</code> is 34. </p>
  
  <p>Here's what I have so far. </p>
  
  <pre><code>sapply(d, function(x) d[which.min(d[[x]]$distance,]$order_number))
  </code></pre>
  
  <p>which gives a syntax error.</p>