title: Spread multiple columns [tidyr]
body: <p>I would like to spread data over multiple columns using <code>tidyr</code>.</p>
  
  <pre><code>  dat &lt;- data.frame(ID = rep(1,10), 
    col1 = LETTERS[seq(1,10)], 
    col2 = c(letters[seq(1,8)],NA,NA),
    col3 = c(rep(NA,8),"5",NA),
    col4 = c(rep(NA,8),NA,"value"))
  </code></pre>
  
  <p>The expected outcome is:</p>
  
  <pre><code>Out &lt;- data.frame(t(c(1,letters[seq(1,8)],"5","value")),row.names=NULL)
  colnames(Out) &lt;- c("ID",LETTERS[seq(1,10)])
  </code></pre>
  
  <p>I came up with:</p>
  
  <pre><code>a &lt;- dat %&gt;% gather(variable, value, -(ID:col1)) %&gt;% 
       unite(temp, col1, variable) %&gt;% 
       spread(temp, value)
  a[,-which(is.na(a))]
  </code></pre>
  
  <p>which is clumsy and also changes the column names. Is there a better solution for this?</p>