Skip to contents

List the archive versions of every force-month file

Usage

lamp_list_versions(snapshot, file_types = NULL)

Arguments

snapshot

A lamp_snapshot from lamp_archive_snapshot().

file_types

Restrict to some of "street", "outcomes" and "stop-and-search"; NULL for all.

Value

A tibble of class lamp_versions with one row per force, month and file type: n_versions, archives (list-column of archive identifiers, oldest first), crc32 (list-column, aligned with archives), differs (TRUE when the versions do not all share one checksum), usize_min, usize_max, and n_available (versions readable locally).

Examples

cache <- tempfile("streetlamp-cache-")
zips <- list.files(
  system.file("extdata", "archive", package = "streetlamp"),
  pattern = "zip$", full.names = TRUE
)
for (z in zips) lamp_archive_register(z, dir = cache)
#> Registered archive "2026-06" from
#> /home/runner/work/_temp/Library/streetlamp/extdata/archive/2026-06.zip.
#> Registered archive "2026-07" from
#> /home/runner/work/_temp/Library/streetlamp/extdata/archive/2026-07.zip.
v <- lamp_list_versions(lamp_archive_snapshot(cache))
v[v$n_versions > 1, c("force_id", "month", "file_type", "n_versions", "differs")]
#> # A tibble: 10 × 5
#>    force_id       month      file_type       n_versions differs
#>    <chr>          <date>     <chr>                <int> <lgl>  
#>  1 dyfed-powys    2026-05-01 outcomes                 2 TRUE   
#>  2 dyfed-powys    2026-05-01 street                   2 TRUE   
#>  3 dyfed-powys    2026-06-01 outcomes                 2 TRUE   
#>  4 dyfed-powys    2026-06-01 street                   2 TRUE   
#>  5 west-yorkshire 2026-05-01 outcomes                 2 TRUE   
#>  6 west-yorkshire 2026-05-01 stop-and-search          2 FALSE  
#>  7 west-yorkshire 2026-05-01 street                   2 TRUE   
#>  8 west-yorkshire 2026-06-01 outcomes                 2 FALSE  
#>  9 west-yorkshire 2026-06-01 stop-and-search          2 FALSE  
#> 10 west-yorkshire 2026-06-01 street                   2 TRUE