title: how to transform/flatten R data frame
body: <p>I have a data frame with names for row identity and dates as column identity.</p>
  
  <pre><code>df &lt;- data.frame(`20171007` = c(8, 4),
                   `20171014` = c(9, 7),
                   row.names = c("Kohl", "Travis"))
  </code></pre>
  
  <p>What I want is a data structure with three columns, where the identity is actually data.</p>
  
  <pre><code>Date (get from column identity)
  Name (get from row identity)
  Value (get from df[r,c])
  </code></pre>
  
  <p>In this particular case I would end up with 4 rows, one for each value. How do I go about flattening my <code>df</code> into that structure?</p>