Skip to contents

Lists the monthly archive snapshots published at https://data.police.uk/data/archive/: one zip per month, each holding the street, outcomes and stop-and-search CSV files for every force and, since the May 2017 snapshot, a rolling window of the latest 36 months (earlier snapshots hold every month back to December 2010). The index is fetched once and cached; pass refresh = TRUE to fetch it again. Without network access a cached index is returned with a warning, and an error of class streetlamp_error_network is raised if there is no cache.

Usage

lamp_archive_index(refresh = FALSE, dir = lamp_cache_dir())

Arguments

refresh

Fetch the page again even if a cached copy exists.

dir

Cache directory; see lamp_cache_dir().

Value

A tibble of class lamp_archive_index with one row per snapshot: archive (identifier such as "2026-07"), label, url, from and to (first and last data month in the zip), n_months, size_gb (as shown on the page) and md5 (the published checksum of the zip). The attribute fetched_at records when the page was read.

Examples

# \donttest{
# Needs network access. The index is cached in a temporary directory, and
# the example prints a message instead of failing when offline.
idx <- tryCatch(
  lamp_archive_index(dir = tempfile("streetlamp-")),
  streetlamp_error_network = function(e) message(conditionMessage(e))
)
#> Network access is disabled by `STREETLAMP_OFFLINE`.
#> ℹ Could not fetch https://data.police.uk/data/archive/.
if (!is.null(idx)) tail(idx)
# }