continuity is based on the 'islands & gaps' concept.
Use case for continuity is to roll up a sequence consisting of smaller duration into a larger epoch governed by some meaningful separation between \(n_\text{lower}\) and \({n - 1}_\text{upper}\) segments.
continuity(
data,
map_fields,
time_fields,
timeout = 0,
boundary_name = "window",
archipelago = TRUE,
show.all = FALSE
)(object): The source dataset, including all non-sessioning fields desired
(string): A vector of strings or symbols indicating the field names that will partition data
(string): A vector of strings or symbols indicating the field names to use as "start" and "stop" temporal indices. If only one value is given, that value will be repeated as the "stop" index
The largest allowable 'gap' in a series of time values before a new 'island' begins: can be a quoted expression that conditionally determines the value.
If using date or datetime values for time_fields, specify the timeout using an appropriate lubridate functions (e.g., days).
(string): The name root of the boundary column names (e.g., "episode" => "episode_start_idx", "episode_end_idx")
(logical | TRUE): Should the output include the islands and gaps generated?
(logical | FALSE): Should the output include all of the columns of the output? show.all and archipelago are independent
A data.table with the following columns <mapFields>, <X>, <Y>:
archipelago = TRUE){boundary_name}_start_idx, {boundary_name}_end_idx, ISLAND, GAP
show.all = TRUE)island_idx, seq_idx, start_idx, stop_idx, rec_idx, map_partition, delta_start, delta_stop
Other Data Generation:
cross_time()
event.vectors::continuity(
event.vectors::evs_src_01
, map_fields = c(join_key, src)
, time_fields = c(date.start, date.end)
, timeout = lubridate::days(7)
, boundary_name = "evs_series"
, show.all = TRUE
)[, .(join_key, src, evs_series_start_idx, evs_series_end_idx, ISLAND, GAP, seq_idx)] |>
split(f = ~join_key) |>
lapply(summary)
#> $`1`
#> join_key src evs_series_start_idx evs_series_end_idx
#> Min. :1 Length:128 Min. :2026-01-02 Min. :2026-05-30
#> 1st Qu.:1 Class :character 1st Qu.:2026-01-02 1st Qu.:2026-05-30
#> Median :1 Mode :character Median :2026-01-02 Median :2026-05-30
#> Mean :1 Mean :2026-04-22 Mean :2026-08-08
#> 3rd Qu.:1 3rd Qu.:2026-07-06 3rd Qu.:2026-09-18
#> Max. :1 Max. :2026-10-22 Max. :2026-12-31
#> ISLAND GAP seq_idx
#> Min. : 20 Min. :-10.00000 days Min. :0.000
#> 1st Qu.: 70 1st Qu.: -2.00000 days 1st Qu.:0.000
#> Median :148 Median : 0.00000 days Median :0.000
#> Mean :108 Mean : 0.03125 days Mean :1.336
#> 3rd Qu.:148 3rd Qu.: 1.25000 days 3rd Qu.:2.000
#> Max. :148 Max. : 10.00000 days Max. :4.000
#>
#> $`2`
#> join_key src evs_series_start_idx evs_series_end_idx
#> Min. :2 Length:109 Min. :2026-01-04 Min. :2026-01-24
#> 1st Qu.:2 Class :character 1st Qu.:2026-03-15 1st Qu.:2026-05-28
#> Median :2 Mode :character Median :2026-06-07 Median :2026-11-08
#> Mean :2 Mean :2026-05-15 Mean :2026-08-19
#> 3rd Qu.:2 3rd Qu.:2026-06-07 3rd Qu.:2026-11-08
#> Max. :2 Max. :2026-12-06 Max. :2026-12-29
#> ISLAND GAP seq_idx
#> Min. : 20.00 Min. :-9.0000 days Min. :0.000
#> 1st Qu.: 31.00 1st Qu.:-2.0000 days 1st Qu.:2.000
#> Median : 74.00 Median : 0.0000 days Median :3.000
#> Mean : 95.23 Mean : 0.3945 days Mean :2.523
#> 3rd Qu.:154.00 3rd Qu.: 3.0000 days 3rd Qu.:3.000
#> Max. :154.00 Max. :11.0000 days Max. :5.000
#>
#> $`3`
#> join_key src evs_series_start_idx evs_series_end_idx
#> Min. :3 Length:24 Min. :2026-01-02 Min. :2026-01-13
#> 1st Qu.:3 Class :character 1st Qu.:2026-02-10 1st Qu.:2026-02-24
#> Median :3 Mode :character Median :2026-07-13 Median :2026-07-17
#> Mean :3 Mean :2026-06-09 Mean :2026-06-18
#> 3rd Qu.:3 3rd Qu.:2026-08-10 3rd Qu.:2026-08-24
#> Max. :3 Max. :2026-11-06 Max. :2026-11-22
#> ISLAND GAP seq_idx
#> Min. : 0.00 Min. :-8.00 days Min. : 0.000
#> 1st Qu.: 2.75 1st Qu.: 3.50 days 1st Qu.: 2.000
#> Median :11.00 Median : 8.00 days Median : 7.500
#> Mean : 9.50 Mean :10.88 days Mean : 6.583
#> 3rd Qu.:16.00 3rd Qu.:17.00 days 3rd Qu.: 9.250
#> Max. :18.00 Max. :48.00 days Max. :13.000
#>