Learn R Programming

surveillance (version 1.23.1)

isoWeekYear: Find ISO Week and Year of Date Objects

Description

The function isoWeekYear extracts the year and week of a Date according to the ISO 8601 specification.

Usage

isoWeekYear(Y, M, D)

Value

A list with entries ISOYear and ISOWeek containing the corresponding results.

Arguments

Y

year(s) or a Date/POSIXt object. Can be a vector.

M

month(s), only used if Y is not a Date/POSIXt object.

D

day(s), only used if Y is not a Date/POSIXt object.

Examples

Run this code
dates <- as.Date(c("2002-12-31","2003-01-01","2003-01-06"))
isoWeekYear(dates)

## the same using numeric inputs:
isoWeekYear(Y = c(2002, 2003, 2003), M = c(12, 1, 1), D = c(31, 1, 6))

Run the code above in your browser using DataLab