The function fetches statistical data for a selected geography framework from: statistics.gov.scot for a selected period for a chosen indicator.

get_geography_data(data_set, geography, period, measure = "count",
  pre_process_results = FALSE, ...)

Arguments

data_set

Required. A character scalar with the name of indicator to be sourced from the statistics.gov.scot.

geography

Required. A character vector corresponding to geographies for which to derive the data or URI corresponding to a specific geography.

period

Optional. A character vector corresponding to period(s) for which the data should be sourced. This has to correspond to the available periods. For instance c("2001Q2", "2010Q2") would get the data for 2nd quarters of 2001 and 2010 respectively.

measure

Required. A character scalar pertaining to measure to be sources, usually count or ratio. Defaults to count.

pre_process_results

A logical, defaults to FALSE. If TRUE will apply pre_process_data function to the results, removing from data frame columns with information on types (uri, literal, ...) and leaving only value and dimension columns. The function can also remove initial part of URI for value and dimension columns.

...

Options passed to pre_process_data, ignored if pre_process_results is FALSE.

Value

A data frame.

Details

The following function attempts to source all data available for specific geographies for the provided period periods. Colloquial geography names are matched with URI values in Standard Geography Code Register. A well known locality name like Edinburgh may match multiple URIs. Have a look at available_data_sets documentations to explore data available in the package and get_available_datasets function to get most recent list.

Examples

# NOT RUN {
get_geography_data(data_set = "alcohol-related-discharge",
                   geography = "East Lothian")
# }