This is the sample data.
created_date start_date
2014-12-11 2014-12-10
2014-12-11 2014-12-11
2014-12-12 2014-12-13
2014-12-13 NULL
2014-12-13 2014-12-13
2014-12-13 2014-12-13
2014-12-23 NULL
2014-12-23 NULL
I'd like to count how many start_date was checked each day, according to the created_date. The value of start_date is not important, only the 'number' of start_dates checked is meaningful.
In this case, the result of for loop should be like this
created_date count
2014-12-11 2
2014-12-12 1
2014-12-13 2
2014-12-23 0
I cannot simply use table() because:
table(created_date) will count created_date, not start_date.
>table(created_date)
created_date count
2014-12-11 2
2014-12-12 1
2014-12-13 3
2014-12-23 2
table(start_date) won't work either, since it doesn't count the created date of "NULL" and more importantly, the value of start_date itself is meaningless.
>table(start_date)
created_date count
2014-12-10 1
2014-12-11 1
2014-12-13 3
NULL 3
I guess for loop should be used, but don't have idea how to code that. Thanks in advance!