subtract_years: Subtract a number of years from a date

View source: R/subtract_years.R

subtract_yearsR Documentation

Subtract a number of years from a date

Description

Subtract a number of years from a date

Usage

subtract_years(date, n_years)

Arguments

date

Date from which to subtract n_years

n_years

Number of years to subtract. Will be coerced to integer - cannot subtract fractions of a year.

Examples

subtract_years(Sys.Date(), 5)
subtract_years(as.Date("2020-01-01"), 1)
## Not run: 
# This returns an error:
subtract_years(Sys.Date(), 1.5)

## End(Not run)

djpr-data/djprlabourdash documentation built on April 28, 2023, 6:16 p.m.