
Read an Ontario-Catalogue XLSX data-dictionary sidecar
Source:R/arsau_datasets.R
morie_arsau_read_xlsx_dictionary.RdSome ARSAU releases ship a companion *.xlsx file alongside
the CSV that holds the column-level data dictionary (variable name
dtype + notes). This helper reads the first sheet (with readxl when installed, else the package's own reader) and normalises the column names to
name / type / notes.
Value
A data.frame with columns name, type,
notes. Other columns from the XLSX are preserved with
their upstream names.
References
Ontario Ministry of the Solicitor General data dictionaries accompanying the ARSAU CSV releases.
Examples
# a two-row dictionary workbook, as an ARSAU release ships it
f <- tempfile(fileext = ".xlsx")
writexl::write_xlsx(data.frame(Variable = c("year", "force_used"),
`Data type` = c("integer", "character"),
Notes = c("fiscal year", "type of force"),
check.names = FALSE), f)
morie_arsau_read_xlsx_dictionary(f)
#> name type notes
#> 1 year integer fiscal year
#> 2 force_used character type of force