logical: Logical tests on messy dates

Description Usage Arguments Value Examples

Description

These functions provide various logical tests for messy date objects. is_messydate() tests whether the object inherits the messydt class. If a more rigorous validation is required, see validate_messydate(). is_intersecting() tests whether there is any intersection between two messy dates, leveraging intersect(). is_element() similarly tests whether a messy date can be found within a messy date range or set. is_similar() tests whether two dates contain similar components. This can be useful for identifying dates that may be typos of one another.

Usage

1
2
3
4
5
6
7

Arguments

x, y

Messy date or other class objects

Value

A logical vector the length of the messy dates passed.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
is_messydate(as_messydate("2012-01-01"))
is_messydate(as.Date("2012-01-01"))
is_intersecting(as_messydate("2012-01"),
as_messydate("2012-01-01..2012-02-22"))
is_intersecting(as_messydate("2012-01"),
as_messydate("2012-02-01..2012-02-22"))
is_element(as_messydate("2012-01-01"), as_messydate("2012-01"))
is_element(as_messydate("2012-01-01"), as_messydate("2012-02"))
is_similar(as_messydate("2012-06-02"), as_messydate("2012-02-06"))
is_similar(as_messydate("2012-06-22"), as_messydate("2012-02-06"))

messydates documentation built on Nov. 12, 2021, 5:06 p.m.