Description Usage Arguments Details Value Author(s) References See Also Examples
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")
.
1 |
date |
Vector which can be coerced to class |
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).
A character vector of year and week in format "%G-W%V
".
Hatto von Hatzfeld hatto@salesianer.de, adopted to R by Uwe Block u.block.mz@gmail.com
http://www.salesianer.de/util/kalwoch.html
strftime
for a description of conversion specifications and references
on ISO 8601.
isoWeekYear
in the surveillance
package for an alternative implementation.
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.