Skip to contents

This function queries the API based on the information required and returns ids as these have no restriction applied to them. The IMD API restricts to 2k records for example.

Postcode and LSOA parameters require data because bringing all the data from the Online_ONS_Postcode_Directory_Live will take too long and is often unnecessary.

Usage

get_data(
  data,
  url_type = c("postcode", "imd"),
  fix_invalid = TRUE,
  column = "default"
)

Arguments

data

dataframe or vector.The data that will connect to either the postcode API or imd API.

url_type

String defaults to postcode which returns information from Online_ONS_Postcode_Directory_Live to return Postcode information via the NHSRpostcodetools package. imd connects to Indices_of_Multiple_Deprivation_(IMD)_2019 to return IMD information.

fix_invalid

Boolean, default TRUE. Whether to try to fix any postcodes that are not found (potentially because they are terminated codes, or contain typos).

column

String. Default would mean the automatic connection of a column called postcode if postcode data is being expected or lsoa11 if imd data as requested via the parameter url_type = "imd".

Value

data frame