How might I generate a list of date objects (POSIXct or lt) for each Monday of a year?
For instance this year would be (In Year, Month, Day):
2012_01_02, 2012_01_09, 2102_01_16, etc
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
EDIT: On further reflection, here’s a cleaner function for doing the same thing:
Here’s a function that’ll perform the more general task of finding the first Monday in an arbitrary year, and then listing it and all of the other Mondays in that year. It uses
seq.POSIXt(), and the argumentby = "week"(which is also available forseq.Date()).