title: How to melt into columns row results?
body: <p>From a frame like this:</p>
  
  <pre><code>df &lt;- data.frame(year = c(2010,2010,2011,2011), stock = c("Amazon","Google","Yahoo","Google")
  </code></pre>
  
  <p>How can we melt the rows and convert into columns count results?
  The expected output:</p>
  
  <pre><code>   stock 2010 2011
  Amazon     1     0
  Google     1     1
  Yahoo     0     1
  </code></pre>