title: R: unique observations conditionally on other variable - from rows into additional columns
body: <p>I am new to R. I struggle to find a suitable solution for the following problem:</p>
  
  <p>My dataframe looks approximately like this:</p>
  
  <pre><code>ID Att  
  1   a  
  1   b  
  1   c  
  2   d  
  3   e  
  3   f  
  4   g  
  </code></pre>
  
  <p>I would like to convert it into a new df of the following form:</p>
  
  <pre><code>ID Att_1 Att_2 ... Att_n 
  
  1   a     b         c          
  2   d    N/A       N/A         
  3   e     f        N/A         
  4   g    N/A       N/A         
  </code></pre>
  
  <p>Where the number of columns is dependent on max counts of unique 'Att' in 'ID' (here three). The generation of the number of columns in the new dataframe (i.e. 'n') should be automated and dependent on the count of :</p>
  
  <pre><code>max_ID_count &lt;- table(df$ID)  
  n &lt;- max(max_ID_count)  
  </code></pre>
  
  <p>Thanks a lot!</p>