s_id u_id product stage log date
2706771 369544 Auto Page 2 03-06-2017 13:01
2706771 369544 Auto Page 1 02-06-2017 15:51
2706771 369544 Auto Page 2 02-06-2017 15:52
2903900 459574 Credit Page 1 16-06-2017 17:14
2903900 459574 Credit Page 2 16-06-2017 17:14
2903900 459574 Credit Submit 16-06-2017 17:14
2903904 1879562 Person Page 1 16-06-2017 17:14
2903904 1879562 Person Page 2 16-06-2017 17:15
2903904 1879562 Person Submit 16-06-2017 17:16
2903904 1879562 Person Page 2 16-06-2017 17:16
My data frame is like above where I want to group by product and count of the stages for each products.
df%>%
group_by(product) %>% summarise(a=count(stages))
I get an error saying-Evaluation error: no applicable method for 'groups' applied to an object of class "factor".
How do I apply count of factor for which have three or more levels(Stage-column) and my expected out table is below where all stage level become a header.
Product Page 1 Page 2 Submit
Auto counts counts counts
Credit counts counts counts
Person counts counts counts