I have the dataset below that I want to tidy up.
user_id topic may june july august september october
1 192775 talk 2 0 0 2 2 1
2 192775 walk 165 123 128 146 113 105
3 192775 bark 0 0 0 0 0 0
4 192775 harp 0 0 0 0 0 1
I want to use tidyr to shape into the below format.
user_id month talk walk bark harp
192775 may 2 165 0 0
192775 june 0 123 0 0
Any help is appreciated
With:
you get:
Another option is to use
recast
from thereshape2
-package: