If dd is of Date class then this code finds the number of days since
May 1st of the same year and then does an integer divide by 7 plus 1
so that the if dd lies in May 1 - May 7 it returns 1 as the week
number, etc.
dd <- as.Date("2000-06-01") # sample input
as.numeric(dd - as.Date(sub("-.*", "-05
R community,
How could I extract the week number from a date vector
(in class Date) such that week numbering (week 1...2...)
begins (May 01) and ends (October 31) on the same specific
dates each year?
Thank you,
Mike
__
R-help@r-project.org mailing
2 matches
Mail list logo