ISOweek {ISOweek} | R Documentation |
Week of the year according to ISO 8601
Description
This function returns the year and the week of the year
of a given date according to ISO 8601. It is an
substitute for the %Y-W%V
format which is not
implemented on Windows.
Usage
ISOweek(date)
Arguments
date |
Vector which can be coerced to class
|
Details
According to ISO 8601, the year of the week can differ from the calendar year (see the examples).
Value
A character vector of year and week in format
"%Y-W%V
"
Author(s)
Hatto von Hatzfeld hatto@salesianer.de, adopted to R by Uwe Block u.block.mz@googlemail.com
References
http://www.salesianer.de/util/kalwoch.html
See Also
strptime
for a description of the date
formats and references on ISO 8601.
isoWeekYear
for an
alternative implementation.
Examples
x <- paste(1999:2011, "-12-31", sep = "")
y <- as.Date(x)
data.frame(date = format(y), week = ISOweek(y))
data.frame(date = x, week = ISOweek(x))
[Package ISOweek version 0.6-2 Index]