title: can't convert a dataset with subdatasets with unequal length into a matrix
body: <p>I have a dataset of the following form</p>
  
  <p>AFG 0011 7</p>
  
  <p>ALB 0011 23</p>
  
  <p>NLD 0011 234</p>
  
  <p>USA 0011 245</p>
  
  <p>AFG 0012 5</p>
  
  <p>ALB 0012 12</p>
  
  <p>NLD 0012 345</p>
  
  <p>USA 0012 334</p>
  
  <p>ALB 0013 34</p>
  
  <p>NLD 0013 56</p>
  
  <p>USA 0013 59</p>
  
  <p>NLD 0015 67</p>
  
  <p>USA 0015 68</p>
  
  <p>I need to transform it into the following conventional matrix</p>
  
  <pre><code>AFG  ALB  NLD  USA
  </code></pre>
  
  <p>0011 7 23 234 245</p>
  
  <p>0012 5 12 345 334</p>
  
  <p>0013 NA 34 56 59</p>
  
  <p>0015 NA NA 67 68</p>
  
  <p>I'm fine if NAs are sustituted with 0s. Unfortunately, I was not able to find a simple solution, as subvectors (AFG, ALB, NLD, USA or NLD, USA) are of different lengths. Will be very grateful for any help.</p>