Add/Subtract Year

x %y+% y

x %y-% y

# S3 method for date_y
%y+%(x, y)

# S3 method for date_y
%y-%(x, y)

# S3 method for date_yq
%y+%(x, y)

# S3 method for date_yq
%y-%(x, y)

# S3 method for date_ym
%y+%(x, y)

# S3 method for date_ym
%y-%(x, y)

# S3 method for date_yw
%y+%(x, y)

# S3 method for date_yw
%y-%(x, y)

Arguments

x

a date_xx vector

y

an integer vector of years

Examples

date_yq(2017, 1) %y+% 1
#> [1] "2018-Q1"
date_yq(2017, 1) %y-% 1
#> [1] "2016-Q1"
date_ym(2017, 1) %y+% 1
#> [1] "2018-M01"
date_ym(2017, 1) %y-% 1
#> [1] "2016-M01"