| operate_within | R Documentation |
date_by_intersecting() is the proportion that goes with
date_is_intersecting().
For each pair of values, it gives the share of pairs of compatible days,
one from x[i] and one from y[i], that are at most within days
apart.
If the two true dates are independent, and each is equally likely to be
any of its compatible days, this is the probability that they are within
within days of each other.
It is 1 when every pair is within the tolerance (a certain match),
between 0 and 1 when some are (a possible match), and 0 when none is.
date_by_intersecting(x, y, within = 0, approx_range = 0)
x, y |
|
within |
A tolerance in days, 0 or more.
Two dates intersect within |
approx_range |
Range to widen approximate values ( |
With approx_range above 0, an approximate value (~ or %) widens as
in compatible_dates(), and each of its days counts by the trapezoidal
weight that vrandom() uses, so that the share is a weighted share.
Days, months, years and ranges of common-era dates are computed from
their first and last days, without a list of days.
Other values (sets, unspecified digits, open ranges) list their days.
A missing value gives NA, and the empty set, {}, gives 0.
A time of day is ignored, and dates before the common era give NA
when within is above 0.
A numeric vector of proportions between 0 and 1, of the common
length of x and y.
# an exact day against a week-long range, and within a day of it
x <- as_messydate("2001-05-13..2001-05-19")
date_by_intersecting(x, as_messydate("2001-05-16"))
date_by_intersecting(x, as_messydate("2001-05-16"), within = 1)
# an approximate date, widened by three days with trapezoidal weights
date_by_intersecting(as_messydate("2001-05-16~"), as_messydate("2001-05-18"),
within = 1, approx_range = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.