[R] extract week from date

Erich Neuwirth erich.neuwirth at univie.ac.at
Fri Apr 12 00:22:25 CEST 2002


this is more complicated.
the definition of week 1 is noct clear.
but as far as i know
the week containing the first of january counts as last week
if at least 4 of its days belong to the old year,
and it is the first week if at least 4 of its days
belong to the new year.

i do not know if there is a standardized definiton
with regard to the fact that the week starts on sunday
in soem countries (us?)
and on monday in some other countries (most european countries?)


>>Does anyone know how obtain the week of a date?
>>(in SPPS the instruction is "xdate.week")
>>
> 
> Extract the day and divide by seven?
> 
> as.POSIXlt(a.date)$yday %/% 7
> 



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list