For a date vector (may span several years):
exampleDates = as.Date( 1 : 15, origin = as.Date( "2012-12-25" ) )
I would like to generate an identifier that groups dates into weeks. So, provided that the calendar starts on Sunday:
- from the 26th to the 29th the same identifier will be issued
- 30th to 5th have the same identifier
- from 6th to 9th have the same identifier
Here is an incorrect attempt:
strftime( exampleDates , format = "%Y%W" )
He sees 31st and 1st places as different weeks (not surprisingly). I'm looking for something similar to strftime that will generate an identifier (character, numeric, any) that I can use to group dates by week.
I am sure that there is some kind of smart function.
r
SFun28
source share