>>>>> "BR" == Barry Rowlingson <[EMAIL PROTECTED]> writes:

    BR> Ah ha. Use '%w' for 'day of week':

    >> strptime("2003 05 06", format="%Y %U %w")
    BR> [1] "2003-02-02"

    BR> I dont have a calendar to hand to check that 2 Feb is the 6th
    BR> day of the 5th week....
It's not, it is the first day of the 5th week in 2003.  Moreover:

> strptime(paste("2003 05 0", 0:6, sep=""), format="%Y %U %w")
[1] "2003-02-02" "2003-02-02" "2003-02-02" "2003-02-02" "2003-02-02"
[6] "2003-02-02" "2003-02-02"

I guess this behaviour is consistent with the description of %U:
 
    `%U' Week of the year as decimal number (00-53) using the first
          Sunday as day 1 of week 1.

??

> strptime(paste("2003 01 0", 0:6, sep=""), format="%Y %U %w")
[1] "2003-01-05" "2003-01-05" "2003-01-05" "2003-01-05" "2003-01-05"
[6] "2003-01-05" "2003-01-05"

5 January 2003 was the first Sunday in 2003.

Cheers,

        Berwin

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to