These functions provide various proportional tests for messy date objects.

e1 %l% e2

# S3 method for mdate
%l%(e1, e2)

e1 %g% e2

# S3 method for mdate
%g%(e1, e2)

e1 %ge% e2

# S3 method for mdate
%ge%(e1, e2)

e1 %le% e2

# S3 method for mdate
%le%(e1, e2)

e1 %><% e2

# S3 method for mdate
%&gt;&lt;%(e1, e2)

e1 %>=<% e2

# S3 method for mdate
%&gt;=&lt;%(e1, e2)

Arguments

e1, e2

mdate or other class objects

Value

The proportion that the comparison is true.

A logical vector the same length as the mdate passed.

Functions

  • %l% : Tests proportion of dates in the first vector that precede the minimum in the second vector.

  • %g% : Tests proportion of dates in the first vector that follow the maximum in the second vector.

  • %ge% : Tests proportion of dates in the first vector that follow or are equal to the maximum in the second vector.

  • %le% : Tests proportion of dates in the first vector that precede or are equal to the minimum in the second vector.

  • %><% : Tests proportion of dates in the first vector that are between the minimum and maximum dates in the second vector.

  • %>=<% : Tests proportion of dates in the first vector that are between the minimum and maximum dates in the second vector, inclusive.

Examples

  as_messydate("2012-06") < as.Date("2012-06-02")
#> [1] NA
  as_messydate("2012-06") %l% as_messydate("2012-06-02")
#> [1] 0.03333333
  as_messydate("2012-06") > as.Date("2012-06-02")
#> [1] NA
  as_messydate("2012-06") %g% as_messydate("2012-06-02")
#> [1] 0.9333333
  as_messydate("2012-06") >= as.Date("2012-06-02")
#> [1] NA
  as_messydate("2012-06") %ge% as_messydate("2012-06-02")
#> [1] 0.9666667
  as_messydate("2012-06") <= as.Date("2012-06-02")
#> [1] NA
  as_messydate("2012-06") %le% "2012-06-02"
#> [1] 0.06666667
  as_messydate("2012-06") %><% as_messydate("2012-06-15..2012-07-15")
#> [1] 0.516129
  as_messydate("2012-06") %>=<% as_messydate("2012-06-15..2012-07-15")
#> [1] 0.5333333