Download force-month files from the data.police.uk archive
Source:R/ingest-archive.R
lamp_archive_download.RdFetches the street, outcomes and stop-and-search CSV files for chosen months and forces from one or more archive snapshots, without downloading the whole zip: the zip's table of contents is read with an HTTP byte-range request and each wanted file is then fetched by range and inflated locally. Files already present in the cache with a matching checksum are skipped. Each fetched file is recorded with its CRC32 from the archive, a SHA-256 of its content and the time of download, which is what the panel contract reports as provenance.
Usage
lamp_archive_download(
archives = "latest",
months = NULL,
forces = NULL,
file_types = c("street", "outcomes", "stop-and-search"),
dir = lamp_cache_dir(),
index = NULL,
relist = FALSE
)Arguments
- archives
Archive identifiers such as
c("2026-06", "2026-07"), or"latest"(the default) for the newest snapshot inlamp_archive_index().- months
Months to fetch as
"YYYY-MM"strings or Dates;NULLfor every month in the archive.- forces
police.uk force identifiers such as
"west-yorkshire";NULLfor every force. Seelamp_forces().- file_types
Which of
"street","outcomes"and"stop-and-search"to fetch.- dir
Cache directory; see
lamp_cache_dir().- index
An archive index from
lamp_archive_index(), to avoid fetching it again.- relist
Read the archive's table of contents again even if it has been listed before.
Value
A lamp_snapshot (see lamp_archive_snapshot()) for dir,
invisibly.