Skip to contents

This function cleans UK postcode data before returning the relevant section (such as its first part of full postcode).

Usage

postcodes(postcode_value, postcode_type = "full")

Arguments

postcode_value

The postcode data to be cleaned (in the form of 'N1 1AA', 'ME1 2RE' or 'TN12 0QS').

postcode_type

The relevant section of the postcode to return. Only one section is permitted. Options are:

full

the full postcode (such as 'N1 1AA')

region

the first part of the first element of the postcode (such as 'ME' for 'ME1 2RE')

area

the first element of the postcode (such as 'ME1' for 'ME1 2RE')

locale

the area and the first part of the second element of the postcode (such as 'ME1 2' for 'ME1 2RE')

Examples

postcodes(
  postcode_value = 'ME1 2re ',
  postcode_type = 'region'
  )
#> [1] "ME"