logical-class.Rd
These functions provide various logical tests for messy date objects.
is_messydate(x)
is_intersecting(x, y)
is_element(x, y)
is_similar(x, y)
is_precise(x)
is_uncertain(x)
is_approximate(x)
mdate
or other class objects
A logical vector the same length as the mdate
passed.
is_messydate()
: tests whether the object inherits the mdate
class.
If more rigorous validation is required, see validate_messydate()
.
is_intersecting()
: tests whether there is any intersection between
two messy dates, leveraging intersect()
.
is_element()
: 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.
is_precise()
: tests whether a date is precise (i.e. an 8 digit date).
Non-precise dates contain markers that they are approximate (i.e. ~),
unreliable (i.e. ?), are incomplete dates (i.e. year only),
or date ranges and sets.
is_uncertain()
: tests whether a date is uncertain (i.e. contains ?).
is_approximate()
: tests whether a date is approximate (i.e. contains ~).
is_messydate(as_messydate("2012-01-01"))
#> [1] TRUE
is_messydate(as.Date("2012-01-01"))
#> [1] FALSE
is_intersecting(as_messydate("2012-01"),
as_messydate("2012-01-01..2012-02-22"))
#> [1] TRUE
is_intersecting(as_messydate("2012-01"),
as_messydate("2012-02-01..2012-02-22"))
#> [1] FALSE
is_element(as_messydate("2012-01-01"), as_messydate("2012-01"))
#> [1] TRUE
is_element(as_messydate("2012-01-01"), as_messydate("2012-02"))
#> [1] FALSE
is_similar(as_messydate("2012-06-02"), as_messydate("2012-02-06"))
#> [1] TRUE
is_similar(as_messydate("2012-06-22"), as_messydate("2012-02-06"))
#> [1] FALSE
is_precise(as_messydate(c("2012-06-02", "2012-06")))
#> [1] TRUE FALSE
is_uncertain(as_messydate(c("2012-06-02", "2012-06-02?")))
#> [1] FALSE TRUE
is_approximate(as_messydate(c("2012-06-02~", "2012-06-02")))
#> [1] TRUE FALSE