gss_lookup: Get data on GSS hierarchies

Description Usage Arguments Details

View source: R/gss_lookup.R

Description

Given a data frame or a vector containing standardised names or codes of UK statistical geographies, return a data frame with a column for each geography that the input geographies are contained within.

Usage

1
2
3
4
5
6
7
gss_lookup(
  data,
  col_gss = "gss_code",
  col_return = NULL,
  vintage = NULL,
  limit = NULL
)

Arguments

data

A data frame containing a column with gss data, or a vector of gss codes or names.

col_gss

If data is a data frame, the name of the column containing gss codes or names.

col_return

Names of resolutions to return. Can be names (e.g. LSOA), gss prefixes (e.g. E01), and optionally can have 2-digit vintage year and/or 'NM' or 'CD' suffixes, e.g. LSOA, LSOA11, LSOA11NM, E01, E0111, E0111CD. If no CD/NM suffix is specified, both will be returned, The vintage must be consistent with vintage (so is entirely cosmetic). Note that all returned column names will be in the format e.g. 'LSOA11CD' regardless of how they were specified.

vintage

A date that the returned GSS codes should be valid for. The default, NULL, is interpreted as the most recent data available. A year (string or integer) gives the 31st December of that year, which is the usual way of dating ONS geographic vintages. A month or date, formatted " is excluded). Also accepts Date objects. Returned column names will include the year of the vintage when the vintage provided was for December 31st, or a date was not specified within the year (e.g. LSOA11CD), otherwise it will be undated (e.g. LSOACD), unless col_return specifies the names.

limit

Integer. The maximum number of rows to return. NULL is unlimited.

Details

Currently only works for official parent geographies, so e.g. 2011 LSOAs are not contained within 2011 wards.

Note that calls to the ONS Open Geography API limit response size to 10 MB. If you're looking for the GSS hierarchy for the whole of the UK, you can use the function with the same name in the geogr.uk package where data are downloaded with the package and stored locally, or get it manually from <TODO: URL>


ChrisFairless/geograpi documentation built on July 4, 2020, 12:01 a.m.