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] "LS5 3JJ"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 426311
#> 
#> $northings
#> [1] 435884
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "Yorkshire and the Humber"
#> 
#> $longitude
#> [1] -1.601838
#> 
#> $latitude
#> [1] 53.81857
#> 
#> $european_electoral_region
#> [1] "Yorkshire and The Humber"
#> 
#> $primary_care_trust
#> [1] "Leeds"
#> 
#> $region
#> [1] "Yorkshire and The Humber"
#> 
#> $lsoa
#> [1] "Leeds 045C"
#> 
#> $msoa
#> [1] "Leeds 045"
#> 
#> $incode
#> [1] "3JJ"
#> 
#> $outcode
#> [1] "LS5"
#> 
#> $parliamentary_constituency
#> [1] "Leeds Central and Headingley"
#> 
#> $parliamentary_constituency_2024
#> [1] "Leeds Central and Headingley"
#> 
#> $admin_district
#> [1] "Leeds"
#> 
#> $parish
#> [1] "Leeds, unparished area"
#> 
#> $admin_county
#> NULL
#> 
#> $date_of_introduction
#> [1] "198001"
#> 
#> $admin_ward
#> [1] "Kirkstall"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS West Yorkshire"
#> 
#> $nuts
#> [1] "Leeds"
#> 
#> $pfa
#> [1] "West Yorkshire"
#> 
#> $codes
#> $codes$admin_district
#> [1] "E08000035"
#> 
#> $codes$admin_county
#> [1] "E99999999"
#> 
#> $codes$admin_ward
#> [1] "E05011402"
#> 
#> $codes$parish
#> [1] "E43000294"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14001319"
#> 
#> $codes$parliamentary_constituency_2024
#> [1] "E14001319"
#> 
#> $codes$ccg
#> [1] "E38000225"
#> 
#> $codes$ccg_id
#> [1] "15F"
#> 
#> $codes$ced
#> [1] "E99999999"
#> 
#> $codes$nuts
#> [1] "TLE42"
#> 
#> $codes$lsoa
#> [1] "E01011488"
#> 
#> $codes$msoa
#> [1] "E02002374"
#> 
#> $codes$lau2
#> [1] "E08000035"
#> 
#> $codes$pfa
#> [1] "E23000010"
#> 
#> 
random_postcode("N1")
#> $postcode
#> [1] "N1 2EJ"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 531896
#> 
#> $northings
#> [1] 184065
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "London"
#> 
#> $longitude
#> [1] -0.099532
#> 
#> $latitude
#> [1] 51.54008
#> 
#> $european_electoral_region
#> [1] "London"
#> 
#> $primary_care_trust
#> [1] "Islington"
#> 
#> $region
#> [1] "London"
#> 
#> $lsoa
#> [1] "Islington 016F"
#> 
#> $msoa
#> [1] "Islington 016"
#> 
#> $incode
#> [1] "2EJ"
#> 
#> $outcode
#> [1] "N1"
#> 
#> $parliamentary_constituency
#> [1] "Islington South and Finsbury"
#> 
#> $parliamentary_constituency_2024
#> [1] "Islington South and Finsbury"
#> 
#> $admin_district
#> [1] "Islington"
#> 
#> $parish
#> [1] "Islington, unparished area"
#> 
#> $admin_county
#> NULL
#> 
#> $date_of_introduction
#> [1] "198001"
#> 
#> $admin_ward
#> [1] "St Mary's & St James'"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS North Central London"
#> 
#> $nuts
#> [1] "Islington"
#> 
#> $pfa
#> [1] "Metropolitan Police"
#> 
#> $codes
#> $codes$admin_district
#> [1] "E09000019"
#> 
#> $codes$admin_county
#> [1] "E99999999"
#> 
#> $codes$admin_ward
#> [1] "E05013710"
#> 
#> $codes$parish
#> [1] "E43000209"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14001306"
#> 
#> $codes$parliamentary_constituency_2024
#> [1] "E14001306"
#> 
#> $codes$ccg
#> [1] "E38000240"
#> 
#> $codes$ccg_id
#> [1] "93C"
#> 
#> $codes$ced
#> [1] "E99999999"
#> 
#> $codes$nuts
#> [1] "TLI43"
#> 
#> $codes$lsoa
#> [1] "E01002793"
#> 
#> $codes$msoa
#> [1] "E02000569"
#> 
#> $codes$lau2
#> [1] "E09000019"
#> 
#> $codes$pfa
#> [1] "E23000001"
#> 
#> 
# }