From a frame like this:
df <- data.frame(year = c(2010,2010,2011,2011), stock = c("Amazon","Google","Yahoo","Google")
How can we melt the rows and convert into columns count results? The expected output:
   stock 2010 2011
Amazon     1     0
Google     1     1
Yahoo     0     1
 
     
     
    