year-week-day-arithmetic: Arithmetic: year-week-day

year-week-day-arithmeticR Documentation

Arithmetic: year-week-day

Description

These are year-week-day methods for the arithmetic generics.

  • add_years()

You cannot add weeks or days to a year-week-day calendar. Adding days is much more efficiently done by converting to a time point first by using as_naive_time() or as_sys_time(). Adding weeks is equally as efficient as adding 7 days. Additionally, adding weeks to an invalid year-week object (i.e. one set to the 53rd week, when that doesn't exist) would be undefined.

Usage

## S3 method for class 'clock_year_week_day'
add_years(x, n, ...)

Arguments

x

⁠[clock_year_week_day]⁠

A year-week-day vector.

n

⁠[integer / clock_duration]⁠

An integer vector to be converted to a duration, or a duration corresponding to the arithmetic function being used. This corresponds to the number of duration units to add. n may be negative to subtract units of duration.

...

These dots are for future extensions and must be empty.

Details

x and n are recycled against each other using tidyverse recycling rules.

Value

x after performing the arithmetic.

Examples

x <- year_week_day(2019, 1, 1)
add_years(x, 1:2)

clock documentation built on May 31, 2023, 9:39 p.m.