title: R reshape by day, month, year
body: <p>I have a simple table in the following format:</p>
  
  <pre><code>Date          val
  2005-01-01    15 
  2005-01-02    18 
  2005-01-03    20
  ...
  </code></pre>
  
  <p>And am trying to reshape it to the following "wide" column format:</p>
  
  <pre><code>Year  Month  day1     day2     day3     day4     ...day31
  2005  01     day1val  day2val  day3val  day4val  ...day31val
  2005  02     day1val  day2val  day3val  day4val  ...day31val
  </code></pre>
  
  <p>I've successfully split the date column into three separate d,m,y columns using</p>
  
  <pre><code>dates_separated &lt;- data.frame(year = as.numeric(format(input_df$DATE, format = "%Y")),
               month = as.numeric(format(input_df$DATE, format = "%m")),
               day = as.numeric(format(input_df$DATE, format = "%d")))
  output_df &lt;- cbind(input_df, dates_sep)
  </code></pre>
  
  <p>I'm trying to use the reshape function to get this done, but am finding my output could be more complicated than it can handle. Is there another function I should be using here? </p>
  
  <p>Edit: I don't believe this was a duplicate of what was suggested. markdly's answer below did exactly what I needed. Thanks!</p>