Skip to contents

Returns a random postcode and all available data for that postcode.

Usage

random_postcode(outcode = NULL)

Arguments

outcode

A string. Filters random postcodes by outcode. Returns null if invalid outcode. Optional.

Value

A list with a random postcode with corresponding characteristics.

See also

postcode_lookup for documentation.

Examples

# \donttest{
random_postcode()
#> $postcode
#> [1] "OX7 7DH"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 444825
#> 
#> $northings
#> [1] 225749
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "South Central"
#> 
#> $longitude
#> [1] -1.349501
#> 
#> $latitude
#> [1] 51.92847
#> 
#> $european_electoral_region
#> [1] "South East"
#> 
#> $primary_care_trust
#> [1] "Oxfordshire"
#> 
#> $region
#> [1] "South East"
#> 
#> $lsoa
#> [1] "West Oxfordshire 002D"
#> 
#> $msoa
#> [1] "West Oxfordshire 002"
#> 
#> $incode
#> [1] "7DH"
#> 
#> $outcode
#> [1] "OX7"
#> 
#> $parliamentary_constituency
#> [1] "Banbury"
#> 
#> $parliamentary_constituency_2024
#> [1] "Banbury"
#> 
#> $admin_district
#> [1] "West Oxfordshire"
#> 
#> $parish
#> [1] "Steeple Barton"
#> 
#> $admin_county
#> [1] "Oxfordshire"
#> 
#> $date_of_introduction
#> [1] "199109"
#> 
#> $admin_ward
#> [1] "The Bartons"
#> 
#> $ced
#> [1] "Woodstock"
#> 
#> $ccg
#> [1] "NHS Buckinghamshire, Oxfordshire and Berkshire West"
#> 
#> $nuts
#> [1] "West Oxfordshire"
#> 
#> $pfa
#> [1] "Thames Valley"
#> 
#> $codes
#> $codes$admin_district
#> [1] "E07000181"
#> 
#> $codes$admin_county
#> [1] "E10000025"
#> 
#> $codes$admin_ward
#> [1] "E05006647"
#> 
#> $codes$parish
#> [1] "E04008327"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14001072"
#> 
#> $codes$parliamentary_constituency_2024
#> [1] "E14001072"
#> 
#> $codes$ccg
#> [1] "E38000136"
#> 
#> $codes$ccg_id
#> [1] "10Q"
#> 
#> $codes$ced
#> [1] "E58001281"
#> 
#> $codes$nuts
#> [1] "TLJ14"
#> 
#> $codes$lsoa
#> [1] "E01028806"
#> 
#> $codes$msoa
#> [1] "E02005994"
#> 
#> $codes$lau2
#> [1] "E07000181"
#> 
#> $codes$pfa
#> [1] "E23000029"
#> 
#> 
random_postcode("N1")
#> $postcode
#> [1] "N1 6DD"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 532914
#> 
#> $northings
#> [1] 182768
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "London"
#> 
#> $longitude
#> [1] -0.085325
#> 
#> $latitude
#> [1] 51.52819
#> 
#> $european_electoral_region
#> [1] "London"
#> 
#> $primary_care_trust
#> [1] "City and Hackney Teaching"
#> 
#> $region
#> [1] "London"
#> 
#> $lsoa
#> [1] "Hackney 027D"
#> 
#> $msoa
#> [1] "Hackney 027"
#> 
#> $incode
#> [1] "6DD"
#> 
#> $outcode
#> [1] "N1"
#> 
#> $parliamentary_constituency
#> [1] "Hackney South and Shoreditch"
#> 
#> $parliamentary_constituency_2024
#> [1] "Hackney South and Shoreditch"
#> 
#> $admin_district
#> [1] "Hackney"
#> 
#> $parish
#> [1] "Hackney, unparished area"
#> 
#> $admin_county
#> NULL
#> 
#> $date_of_introduction
#> [1] "198001"
#> 
#> $admin_ward
#> [1] "Hoxton West"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS North East London"
#> 
#> $nuts
#> [1] "Hackney"
#> 
#> $pfa
#> [1] "Metropolitan Police"
#> 
#> $codes
#> $codes$admin_district
#> [1] "E09000012"
#> 
#> $codes$admin_county
#> [1] "E99999999"
#> 
#> $codes$admin_ward
#> [1] "E05009378"
#> 
#> $codes$parish
#> [1] "E43000202"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14001260"
#> 
#> $codes$parliamentary_constituency_2024
#> [1] "E14001260"
#> 
#> $codes$ccg
#> [1] "E38000255"
#> 
#> $codes$ccg_id
#> [1] "A3A8R"
#> 
#> $codes$ced
#> [1] "E99999999"
#> 
#> $codes$nuts
#> [1] "TLI41"
#> 
#> $codes$lsoa
#> [1] "E01001780"
#> 
#> $codes$msoa
#> [1] "E02000371"
#> 
#> $codes$lau2
#> [1] "E09000012"
#> 
#> $codes$pfa
#> [1] "E23000001"
#> 
#> 
# }