I want columns counting for events per day including dates without events. This is an example of my data although my real dataset has more than 100 ID's
dt <- structure(list(id = c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), date = c("1/01/2000", "2/01/2000", "2/01/2000",
"5/01/2000", "5/01/2000", "5/01/2000", "6/01/2000", "2/01/2000", "3/01/2000",
"3/01/2000", "4/01/2000", "4/01/2000", "4/01/2000", "4/01/2000",
"5/01/2000", "9/01/2000")), .Names = c("id", "date"),
row.names = c(NA, -16L), class = "data.frame")
What I want is:
date count 1 count 2
1/01/2000 0 0
2/01/2000 2 1
3/01/2000 0 2
4/01/2000 0 4
5/01/2000 3 1
6/01/2000 1 0
7/01/2000 0 0
8/01/2000 0 0
9/01/2000 0 1
My real data will be dates from 1/01/2000 to 31/12/2000. I want all ID's to have all these dates, even if there were zero events during certain days.