Learn R Programming

messydates (version 0.5.4)

operate_inequalities: Logical operations on messy dates

Description

Logical operations on messy dates

Usage

# S3 method for mdate
<(e1, e2)

# S3 method for mdate >(e1, e2)

# S3 method for mdate <=(e1, e2)

# S3 method for mdate >=(e1, e2)

Arguments

e1, e2

mdate or other class objects

Functions

  • < : tests whether the dates in the first vector precede the dates in the second vector. Returns NA when the date order can't be determined.

  • > : tests whether the dates in the first vector succeed the dates in the second vector. Returns NA when the date order can't be determined.

  • <= : tests whether the dates in the first vector are equal to or precede the dates in the second vector. Returns NA when the date order can't be determined.

  • >= : tests whether the dates in the first vector are equal to or succeed the dates in the second vector. Returns NA when the date order can't be determined.

Examples

Run this code
as_messydate("2012-06-02") > as.Date("2012-06-01") # TRUE
# 2012-06-XX could mean 2012-06-03, so unknown if it comes before 2012-06-02
as_messydate("2012-06-XX") < as.Date("2012-06-02") # NA
# But 2012-06-XX cannot be before 2012-06-01
as_messydate("2012-06-XX") >= as.Date("2012-06-01") # TRUE

Run the code above in your browser using DataLab