title: Converting a data.frame to a list of lists
body: <p>How can I convert a data.frame</p>
  
  <pre><code>df &lt;- data.frame(id=c("af1", "af2"), start=c(100, 115), end=c(114,121))
  </code></pre>
  
  <p>To a list of lists</p>
  
  <pre><code>LoL &lt;- list(list(id="af1", start=100, end=114), list(id="af2", start=115, end=121))
  </code></pre>
  
  <p>I've tried things like</p>
  
  <pre><code>not.LoL &lt;- as.list(as.data.frame(t(df)))
  </code></pre>
  
  <p>and I'm really not sure what I end up with after this, but it isn't quite right. My requirement is that I can access, say, the first <code>start</code> by the command</p>
  
  <pre><code>&gt; LoL[[1]]$start
  [1] 100
  </code></pre>
  
  <p>the <code>not.LoL</code> that I currently have gives me the following error:</p>
  
  <pre><code>&gt; not.LoL[[1]]$start
  Error in not.LoL[[1]]$start : $ operator is invalid for atomic vectors
  </code></pre>
  
  <p>Explanations and/or solutions would be greatly appreciated.</p>
  
  <p>Edit: I should have made it clear that "id" here is actually non-unique - there can be multiple elements under a single ID. So I could do with a solution that doesn't depend on unique IDs to <code>split</code> on.</p>