date2ISOweek: Converts date from standard notation to week notation...

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

Description

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

Usage

1

Arguments

date

Vector which can be coerced to class Date

Details

The conversion specifications %g, %G, %u, %V 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, week, and weekday in format "%G-W%V-%u"

Author(s)

Uwe Block [email protected]

See Also

The inverse function ISOweek2date. strftime for a description of conversion specifications and references on ISO 8601.

Examples

1
2
3
4
x <- paste(1999:2011, "-12-31", sep = "")
y <- as.Date(x)
data.frame(date = format(y), weekdate = date2ISOweek(y))
data.frame(date = x, weekdate = date2ISOweek(x))

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