[R] ISO 8601 Weeks/Years on Windows with strptime

Gustaf Rydevik gustaf.rydevik at gmail.com
Thu Jun 3 13:24:32 CEST 2010

2010/6/3 Michael Höhle <Michael.Hoehle at stat.uni-muenchen.de>:
> Dear R-help,
> I am working on a R package for public health surveillance where the ISO
> 8601 representation of dates is of importance. Especially, the ISO Week
> and ISO Year of a date needs to be extracted. I was quite happy to find
> all of this implemented in the "Date" class with appropriate calls to
> strptime/format (using e.g. %G and %V).
> However, only later I realized that this functionality is currently not
> implemented on Windows (I'm a happy Mac/Linux user). As this seriously
> limits the applicability, I would like to enquire, if there are any plans
> to make this functionality available in Windows as well? Or are there any
> good workarounds to make
>> format.Date("2001-12-31", "%G")
> give "2002" instead of "" on Windows?
> Best regards,
> Michael Höhle
> -


This seems to be a problem that crops up from time to time.
I wrote a small function  that got the ISO week of a Date object, that
you can find in a bug-fixed version here:

Hope this is of help. I agree that it would be of interest to
incorporate OS-independent date management in R, but not being part of
the R development team, I'm not sure how to go about implementing

Best regards,

Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE

More information about the R-help mailing list