title: How to convert two columns of dataframe into named vector?
body: <p>I'm trying to convert a dataframe consisting of two columns into a named vector (nested list). The information in each row is essentially key:value pairs, so the lists in the final vector should each be named by the keys and contain their respective values.</p>
  
  <pre><code>Example input:
  
  Var1   Var2
  A      1
  A      2
  B      1
  B      3
  C      3
  C      4
  C      5
  
  Example Output:
  namedArray = list(A = c(1,2), B = c(1,3), C = c(3,4,5))
  </code></pre>
  
  <p>I managed to do this using <code>dcast()</code> in the reshape2 package, however this required additional post-processing to remove row names and NA's introduced by casting the data frame.</p>
  
  <p>Is there a more efficient way to accomplish this?</p>