operate: Arithmetic operations for messydates

operateR Documentation

Arithmetic operations for messydates

Description

These operations allow users to add or subtract dates messydate objects. Messydate objects include incomplete or uncertain dates, ranges of dates, negative dates, and date sets.

Usage

## S3 method for class 'mdate'
e1 + e2

## S3 method for class 'mdate'
e1 - e2

Arguments

e1

An mdate or date object.

e2

An mdate, date, or numeric object. Must be a scalar.

Value

A messydates vector

Examples


d <- as_messydate(c("2008-03-25", "-2012-02-27", "2001-01?", "~2001",
"2001-01-01..2001-02-02", "{2001-01-01,2001-02-02}",
"2008-XX-31", "..2002-02-03", "2001-01-03..", "28 BC"))
tibble::tibble(date = d, add = d + 1, subtract = d - 1)
tibble::tibble(date = d, add = d + "1 year", subtract = d - "1 year")
as_messydate("2001-01-01") + as_messydate("2001-01-02..2001-01-04")
as_messydate("2001-01-01") + as_messydate("2001-01-03")
as_messydate("2001-01-01..2001-01-04") - as_messydate("2001-01-02")
#as_messydate("2001-01-01") - as_messydate("2001-01-03")


messydates documentation built on May 29, 2024, 2:16 a.m.