Learn R Programming

ISOweek (version 0.6-2)

ISOweekday: Day of week according to ISO 8601

Description

This function returns the weekday of a given date according to ISO 8601. It is an substitute for the "%u" format which is not implemented on Windows.

Usage

ISOweekday(date)

Arguments

date
Vector which can be coerced to class Date

Value

An integer vector of weekdays (1-7, Monday is 1)

See Also

strptime

Examples

Run this code
x <- paste(1999:2011, "-12-31", sep = "")
y <- as.Date(x)
data.frame(date = format(y), weekday = ISOweekday(y))
data.frame(date = x, weekday = ISOweekday(x))

Run the code above in your browser using DataLab