Title: | Indices of Multiple Deprivation (IMD) for England |
---|---|
Description: | This package includes functions to retrieve the Indices of Multiple Deprivation (IMD) data from the ONS by LSOA, currently for England. |
Authors: | Zoë Turner [aut, cre] , Francis Barton [aut] , Milan Wiedemann [aut] , Chris Beeley [aut] |
Maintainer: | Zoë Turner <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.2 |
Built: | 2024-11-20 04:35:45 UTC |
Source: | https://github.com/nhs-r-community/NHSRpopulation |
Only required for IMD as postcodes is routed through the NHSRpostcodetools package
api_url()
api_url()
dataset
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.
get_data( data, url_type = c("postcode", "imd"), fix_invalid = TRUE, column = "default" )
get_data( data, url_type = c("postcode", "imd"), fix_invalid = TRUE, column = "default" )
data |
dataframe or vector.The data that will connect to either the postcode API or imd API. |
url_type |
String defaults to |
fix_invalid |
Boolean, default |
column |
String. Default would mean the automatic connection of a
column called |
data frame
Function to check if a string is an LSOA code
is_lsoa(data)
is_lsoa(data)
data |
string |
Logical
With or without one space is permitted. Does not work with data where two spaces are included with 6 character postcodes. From the MIT licenced package Rbduk https://github.com/sama-ds/Rbduk/blob/main/R/is_postcode.R
is_postcode(data)
is_postcode(data)
data |
string |
Logical
is_postcode("SW1a2nP") is_postcode("SW1a 2nP")
is_postcode("SW1a2nP") is_postcode("SW1a 2nP")