Skip to contents

For each HOOD_158 neighbourhood, sorts events chronologically and computes the gap (in days) between consecutive events. Returns the per-neighbourhood mean, median, and total gaps. No censoring is applied (every gap is observed).

Usage

mrm_tps_neighbourhood_recurrence_km(
  data,
  date_col = "OCC_DATE",
  hood_col = "HOOD_158",
  min_gap_days = 0
)

Arguments

data

A data.frame with date_col and hood_col.

date_col

Column name of the date column (default "OCC_DATE").

hood_col

Column name of the neighbourhood ID (default "HOOD_158").

min_gap_days

Smallest gap to include (default 0).

Value

A data.frame with one row per neighbourhood, columns hood, n_events, n_gaps, mean_gap_days, median_gap_days, p25_gap_days, p75_gap_days.

Examples

if (FALSE) {
  tps <- read.csv("Assault_Open_Data.csv")
  mrm_tps_neighbourhood_recurrence_km(tps)
}