How can I go from a table like this:
ID Day car_id value
1 1 1 0
1 1 2 4
1 2 1 1
1 3 2 0
2 1 3 0
2 2 3 2
2 3 3 0
...
To one like this? I have tried using dcast from the package reshape2. It works fine, but as the dataset is quite big, it is a bit slow. Is there another way to do it faster?
ID Day c_id1 c_id2 c_id3
1 1 0 4 0
1 2 1 0 0
1 3 0 0 0
2 1 0 0 0
2 2 0 0 3
2 3 0 0 0
Thank you!