The mdates_duration class introduces methods that annotate a duration or period with representations of its uncertainty.

new_messyduration(x = character())

messyduration(x, approx_range = 0)

validate_messyduration(x, approx_range = 0)

# S3 method for character
messyduration(x, approx_range = 0)

# S3 method for mdate
messyduration(x, approx_range = 0)

Arguments

x

An mdate variable with ranges.

approx_range

Range to expand approximate dates, in days. If 3, for example, adds 3 days; if -3, removes 3 days from both sides.

Value

Object of class description

Details

Most R packages handle duration and periods as exact time or date intervals. However, this is not possible for 'messy' dates where uncertainty or approximation might be present. The mdates_duration class accounts for uncertainty and approximation in mdate objects to return their duration as a range of possible dates.

Examples

messyduration(as_messydate(c("2010-01-01..2010-12-31", "2010-01..2010-12")))
#>  'mdates_duration' chr [1:2] "2010-01-01..2010-12-31" ...