title: How to control new variables' names after tidyr's spread?
body: <p>I have a dataframe with panel structure: 2 observations for each unit from two years:</p>
  
  
  
  <pre class="lang-r prettyprint-override"><code>library(tidyr)
  mydf &lt;- data.frame(
      id = rep(1:3, rep(2,3)), 
      year = rep(c(2012, 2013), 3), 
      value = runif(6)
  )
  mydf
  #  id year      value
  #1  1 2012 0.09668064
  #2  1 2013 0.62739399
  #3  2 2012 0.45618433
  #4  2 2013 0.60347152
  #5  3 2012 0.84537624
  #6  3 2013 0.33466030
  </code></pre>
  
  <p>I would like to reshape this data to wide format which can be done easily with <code>tidyr::spread</code>. However, as the values of the <code>year</code> variable are numbers, the names of my new variables become numbers as well which makes its further use harder. </p>
  
  <pre class="lang-r prettyprint-override"><code>spread(mydf, year, value)
  #  id       2012      2013
  #1  1 0.09668064 0.6273940
  #2  2 0.45618433 0.6034715
  #3  3 0.84537624 0.3346603
  </code></pre>
  
  <p>I know I can easily rename the columns. However, if I would like to reshape within a chain with other operations, it becomes inconvenient. E.g. the following line obviously does not make sense.</p>
  
  <pre class="lang-r prettyprint-override"><code>library(dplyr)
  mydf %&gt;% spread(year, value) %&gt;% filter(2012 &gt; 0.5)
  </code></pre>
  
  <p>The following works but is not that concise:</p>
  
  <pre class="lang-r prettyprint-override"><code>tmp &lt;- spread(mydf, year, value)
  names(tmp) &lt;- c("id", "y2012", "y2013")
  filter(tmp, y2012 &gt; 0.5)
  </code></pre>
  
  <p>Any idea how I can change the new variable names within <code>spread</code>?</p>