ISOweek: Week of the year according to ISO 8601

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Returns the year and the week of the year of a given date according to ISO 8601. It is an alternative to strftime(x, "%G-W%V").

Usage

1

Arguments

date

Vector which can be coerced to class Date.

Details

The conversion specifications %g, %G, %V, %u where not available on Windows and MacOS before R 3.1.0. 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 "%G-W%V".

Author(s)

Hatto von Hatzfeld hatto@salesianer.de, adopted to R by Uwe Block u.block.mz@gmail.com

References

http://www.salesianer.de/util/kalwoch.html

See Also

strftime for a description of conversion specifications and references on ISO 8601.

isoWeekYear in the surveillance package for an alternative implementation.

Examples

1
2
3
4
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))

UweBlock/ISOweek documentation built on May 9, 2019, 9:41 p.m.