iso_year_week_day: Calendar: iso-year-week-day

Description Usage Arguments Details Value Examples

View source: R/iso-year-week-day.R

Description

iso_year_week_day() constructs a calendar from the ISO year, week number, and week day.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
iso_year_week_day(
  year,
  week = NULL,
  day = NULL,
  hour = NULL,
  minute = NULL,
  second = NULL,
  subsecond = NULL,
  ...,
  subsecond_precision = NULL
)

Arguments

year

[integer]

The ISO year. Values [-32767, 32767] are generally allowed.

week

[integer / "last" / NULL]

The ISO week. Values [1, 53] are allowed.

If "last", then the last week of the ISO year is returned.

day

[integer / NULL]

The day of the week. Values [1, 7] are allowed, with 1 = Monday and 7 = Sunday, in accordance with the ISO specifications.

hour

[integer / NULL]

The hour. Values [0, 23] are allowed.

minute

[integer / NULL]

The minute. Values [0, 59] are allowed.

second

[integer / NULL]

The second. Values [0, 59] are allowed.

subsecond

[integer / NULL]

The subsecond. If specified, subsecond_precision must also be specified to determine how to interpret the subsecond.

If using milliseconds, values [0, 999] are allowed.

If using microseconds, values [0, 999999] are allowed.

If using nanoseconds, values [0, 999999999] are allowed.

...

These dots are for future extensions and must be empty.

subsecond_precision

[character(1) / NULL]

The precision to interpret subsecond as. One of: "millisecond", "microsecond", or "nanosecond".

Details

Fields are recycled against each other.

Fields are collected in order until the first NULL field is located. No fields after the first NULL field are used.

Value

A iso-year-week-day calendar vector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Year-week
x <- iso_year_week_day(2019:2025, 1)
x

# 2nd day of the first ISO week in multiple years
iso_days <- set_day(x, clock_iso_weekdays$tuesday)
iso_days

# What year-month-day is this?
as_year_month_day(iso_days)

clock documentation built on July 23, 2021, 1:06 a.m.