[R] Convert week value to date

Heikki Kaskelma heikki.kaskelma at nbl.fi
Fri Aug 19 01:49:29 CEST 2011


Folkes, Michael:
>
> I now realize I could write code to evaluate which of the first 7 days
> in the year is a Monday and then I'd know the start of week 1 in each
> year, and multiply from there.

But note that

> library(surveillance) # ISO week
> isoWeekYear(as.Date("2010-01-01"))$ISOWeek
[1] 53

so that 2010-01-01 is actually on the week 53 of the year 2009.
January 4th is always on week 1 of the same year

> isoWeekYear(as.Date("2010-01-04"))$ISOWeek
[1] 1

and every now and then there are 53 weeks in a year, not 52.


Heikki Kaskelma
Munkkiniemi



More information about the R-help mailing list