The arithmetic operations +, - as well as sequence generation with seq() are all supported for date_yq and date_ym objects. Other binary arithmetic operators are disabled (see date_xx_arithmetic_disabled).

# S3 method for date_xx
+(x, y)

# S3 method for date_xx
-(x, y)

Arguments

x

a date_yq or date_ym object

y

an integer

See also

Examples

q <- date_yq(2018, 1) q + 5
#> [1] "2019-Q2"
q - 1
#> [1] "2017-Q4"
seq(q, q + 5)
#> [1] "2018-Q1" "2018-Q2" "2018-Q3" "2018-Q4" "2019-Q1" "2019-Q2"
m <- date_ym(2018, 12) m + 1
#> [1] "2019-M01"
m - 13
#> [1] "2017-M11"
seq(m - 1, m + 1)
#> [1] "2018-M11" "2018-M12" "2019-M01"