## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>") ## ----------------------------------------------------------------------------- library(pksR) ## ----eval = FALSE------------------------------------------------------------- # # Total offences, harmonized to the latest boundary (the default) # total <- pks_get(offence = "total") # # # Offences by key, short name or label, in English or German # burglary <- pks_get(offence = c("residential_burglary", "einbruch"), lang = "en") # # # Two years as published by the BKA, all offence keys # published <- pks_get(years = 2024:2025, harmonize_to = NULL) # # # A fixed data release, for reproducible work # d <- pks_get(years = 2015:2025, version = "2026.1") ## ----------------------------------------------------------------------------- d <- pks_example() d[, c("year", "ags", "region_name", "offence_key", "cases", "hz", "harmonized")] ## ----------------------------------------------------------------------------- attributes(d)[c("data_version", "boundary_year", "weights")] ## ----------------------------------------------------------------------------- pks_offences("theft", lang = "en")[, c("offence_key", "name", "label")] ## ----------------------------------------------------------------------------- b <- pks_breaks() b[b$comparable == "no", c("first_year", "offence_key", "type")] ## ----------------------------------------------------------------------------- r <- pks_rates(d, per = 1000) head(r[, c("year", "ags", "offence_key", "cases", "rate")]) pks_validate(d) ## ----eval = FALSE------------------------------------------------------------- # pks_cite() ## ----eval = FALSE------------------------------------------------------------- # pks_cache_info() # pks_cache_clear(version = "2026.1")