title: Modify a data frame converting colnames into factor
body: <p>I´m analyzing some data structured as "df" in the example and I need to convert it into something like the "example" object below: </p>
  
  <pre><code>a&lt;- c(1:3)
  b&lt;- c(1:3)
  c&lt;- c(1:3)
  
  df&lt;- data.frame(a, b, c)
  
  col1&lt;- c("a","a","a", "b", "b", "b", "c", "c", "c")
  col2&lt;- rep(1:3,3)
  
  example&lt;- data.frame(col1, col2)
  </code></pre>