Learn R Programming

ISOweek (version 0.6-2)

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

Description

This function 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.

Usage

ISOweek2date(weekdate)

Arguments

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

Value

A vector of class Date

Details

According to ISO 8601, the year of the week can differ from the calendar year (see the examples).

See Also

strptime for a description of the date formats and references on ISO 8601.

Examples

Run this code
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)

Run the code above in your browser using DataLab