[R] How to get week of the year, scale 1-52?
Lauri Nikkinen
lauri.nikkinen at iki.fi
Tue Mar 18 12:55:53 CET 2008
R users,
I have a vector of dates
days <- seq(as.Date("2007/1/1"), as.Date("2008/1/31"), "days")
and I would like to have week numbers from 1 to 52 for each year. How
do I do that? Now I get 00-53 using
format(days, "%W")
> range(format(days, "%W"))
[1] "00" "53"
I have read "Date and Time Classes in R" (R news 01/04 by Gabor
Grothendieck and Thomas Petzoldt) with no help.
Thanks
Lauri
More information about the R-help
mailing list