Skip to contents

Read a Scottish Postcode Directory (SPD) lookup file into a tibble.

Usage

get_spd(version = "latest", col_select = NULL)

Arguments

version

A string defining a version to read in. The default value is "latest" and the latest SPD file available on cl-out will be loaded. Alternatively you can supply a tag, e.g. "2023_2", to load a specific file.

col_select

A character vector of column names to keep, as in the "select" argument to data.table::fread(), or a tidy selection specification of columns, as used in dplyr::select().

Value

A tibble of the Scottish Postcode Directory lookup file or its selected columns.

Examples

get_spd()
#> Error: [ENOENT] Failed to search directory '/conf/linkage/output/lookups/Unicode/Geography/Scottish Postcode Directory': no such file or directory
get_spd(version = "2023_2", col_select = c("pc7", "latitude", "longitude"))
#> Error:  SPD version "2023_2" is NOT available
#>  Contact phs.geography@phs.scot