Hi, I have something very interesting:

Say I have this:

 GroupID         Date
1      1       10-Dec-12
2      1       11-Dec-12
3      2       13-Dec-12
4      2       15-Dec-12
5      3       06-Dec-12
6      3       19-Dec-12

Now, I have time interval,

week 1: from 9-Dec-12 to 15-Dec-12,

week 2: from 16-Dec-12 to 22-Dec-12, and so on.

Obviously, the 1st, 2nd, 3rd, 4th row falls to week 1, 5th rows should not
be counted, 6th row falls into week2.

Therefore, by GroupID, I will have

GroupID=1, Week1=2, Week2=0
GroupID=2, Week1=2, Week2=0
GroupID=3, Week1=0, Week2=1.

I just want to count the valid date that falls into a 7-day week interval,
and I shall have new variables for EACH WEEK, and the counts for dates that
fall into this week interval.

Can anyone please help me on programming this?

W

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to