ISOweek2date: Converts date from week notation according to ISO 8601 to...

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

Description

Returns the date of a given weekdate (year, week of the year, day of week according to ISO 8601). It is the inverse function to date2ISOweek and a substitute for strptime(x, "%G-W%V-%u").

Usage

1
ISOweek2date(weekdate)

Arguments

weekdate

A character vector of year, week, and weekday in format "%G-W%V-%u"

Details

strptime accepts but ignores the conversion specifications %g, %G, %V on input. According to ISO 8601, the year of the week can differ from the calendar year (see the examples).

Value

A vector of class Date

Author(s)

Uwe Block [email protected]

See Also

The inverse function date2ISOweek. strptime for a description of conversion specifications and references on ISO 8601.

Examples

1
2
3
4
5
6
7
w <- paste("2009-W53", 1:7, sep = "-")
data.frame(weekdate = w, date = ISOweek2date(w))
# convert from calendar date to week date and back to calendar date
x <- paste(1999:2011, "-12-31", sep = "")
w <- date2ISOweek(x)
d <- ISOweek2date(w)
data.frame(date = x, weekdate = w, date2 = d)

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