Given a four-element vector of start and end coordinates of two events, cross_time() compares the distances among the upper and lower boundaries of pairs of event vectors. This includes "like" boundary comparison (e.g., start #2 - start#1) and contrary boundary comparison (e.g. start #2 - end #1).

cross_time(
  s0,
  s1,
  e0,
  e1,
  control = list(-Inf, Inf),
  chatty = FALSE,
  unit = NULL,
  cache = NULL,
  ...
)

Arguments

s0

A numeric/date-coded vector containing the temporal lower boundary of the starting event duration

s1

A numeric/date-coded vector containing the temporal upper boundary of the starting event duration

e0

A numeric/date-coded vector containing the temporal lower boundary of the ending event duration

e1

A numeric/date-coded vector containing the temporal upper boundary of the ending event duration

control

A length-2 sorted list with values indicating the range of allowable values for internal variable beta (the difference between ends of 'to' events and beginnings of 'from' events)

chatty

(logical | FALSE) Verbosity flag

unit

One of the lubridate d<duration>() functions

cache

(Optional) A cache_disk, cache_disk object, or TRUE which defaults to cache_disk

...

(Not used)

Value

A data.table object having the following fields:

mGap

Metric describing the difference between the following temporal boundaries: TO.start and FROM.end.

mSt

Metric describing the difference between the following temporal boundaries: TO.start and FROM.start.

mEd

Metrics describing the difference between the following temporal boundaries: TO.end and FROM.end.

from_len

The duration of time of each "from" event; units are on the scale of the smallest increment of time represented (e.g., calendar dates in days will have lengths expressed in days).

to_len

The duration of time of each "to" event; units are on the scale of the smallest increment of time represented (e.g., calendar dates in days will have lengths expressed in days).

epsilon

A complex number (e.g., 1337 + 0.90210i) describing the relational changes from one event to another with interpretation based on whether or not the real and imaginary parts are > 0, < 0, or == 0:

ReImDesc
{> 0}{0}Disjoint
{0}{> 0}Concurrency
{> 0}{> 0}Full Concurrency
{0}{0}Continuity
epsilon_desc

A plain-language description of epsilon.

See also

Other Data Generation: continuity()

Examples

local({
  date_1 <- lubridate::as_date(20774, origin = lubridate::origin)
  date_2 <- lubridate::as_date(20776, origin = lubridate::origin)
  date_3 <- lubridate::as_date(20777, origin = lubridate::origin)
  date_4 <- lubridate::as_date(20781, origin = lubridate::origin)
  date_5 <- lubridate::as_date(20782, origin = lubridate::origin)
  date_6 <- lubridate::as_date(20790, origin = lubridate::origin)

  #       date_1       date_2       date_3       date_4       date_5       date_6 
  # "2026-11-17" "2026-11-19" "2026-11-20" "2026-11-24" "2026-11-25" "2026-12-03" 

  data.table::rbindlist(list(
    # Concurrency
    cross_time(s0 = date_1, s1 = date_2, e0 = date_4, e1 = date_5, unit = "hours")
    # Full Concurrency
    , cross_time(s0 = date_1, s1 = date_3, e0 = date_6, e1 = date_5, unit = "hours")
    # Disjoint
    , cross_time(s0 = date_1, s1 = date_4, e0 = date_3, e1 = date_5, unit = "hours")
    # Continuity
    , cross_time(s0 = date_1, s1 = date_3, e0 = date_3, e1 = date_5, unit = "hours")
    )) |>
  str()
})
#> Classes ‘data.table’ and 'data.frame':	4 obs. of  11 variables:
#>  $ beta        : num  8 8 8 8
#>  $ mGap        : 'difftime' num  -5 -13 4 0
#>   ..- attr(*, "units")= chr "days"
#>  $ mSt         : 'difftime' num  2 3 7 3
#>   ..- attr(*, "units")= chr "days"
#>  $ mEd         : 'difftime' num  1 -8 5 5
#>   ..- attr(*, "units")= chr "days"
#>  $ epsilon     : cplx  0.994-0.447i 0+1.494i 1.329+0i ...
#>  $ epsilon_desc: chr  "Concurrency" "Full Concurrency" "Disjoint" "Continuity"
#>  $ from_len    : 'difftime' num  7 16 3 3
#>   ..- attr(*, "units")= chr "days"
#>  $ to_len      : 'difftime' num  6 5 1 5
#>   ..- attr(*, "units")= chr "days"
#>  $ from_coord  : chr  "2026-11-17:2026-11-24" "2026-11-17:2026-12-03" "2026-11-17:2026-11-20" "2026-11-17:2026-11-20"
#>  $ to_coord    : chr  "2026-11-19:2026-11-25" "2026-11-20:2026-11-25" "2026-11-24:2026-11-25" "2026-11-20:2026-11-25"
#>  $ x_filter    : logi  TRUE TRUE TRUE TRUE
#>  - attr(*, ".internal.selfref")=<externalptr>