On Tue, Apr 20, 2010 at 7:59 PM, Michael Hosack <mhosa...@hotmail.com> wrote:
>
> R experts,
>
> How could I extract the week number from a date vector (in Date class)
> such that week numbering (week 1...2...) begins (May 01) and ends
> (October 31) on the same specific dates each year? Week numbering
> must conform to the following day numbering format 
> (Sat=1,Sun=2,Mon=3.....Fri=7).
> This means that new weeks must begin on Saturdays, and end on Fridays
> (except for the first date of May 01, which always begins week 1; week 2
> begins on the proceeding Saturday). This needs to be applicable across years
> to work effectively. I have tried using both vectorized and loop approaches 
> with
> no success.
>
> I am including a bit of old Systat code that does the trick simply and 
> concisely.
> If anyone knows an analogous method in R please let me know. My R dataframe 
> contains
> all the variables and data in the Systat temp file.
>
> Use sched3.t
> Save sched4.t
> Hold
> By mm dd
> If bof then let week=1
> Else if bog and DOW$="SAT" then let week = week + 1
> Run
>
>
> Thank you,
>
> Mike
>
>

>From your code, it seems as if you're assuming that SCHEDULE3 contains
all consecutive saturdays, without skipping any. Is that correct?

/Gustaf

______________________________________________
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