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] "BH8 9JW"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 411636
#> 
#> $northings
#> [1] 94009
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "South West"
#> 
#> $longitude
#> [1] -1.836444
#> 
#> $latitude
#> [1] 50.74557
#> 
#> $european_electoral_region
#> [1] "South West"
#> 
#> $primary_care_trust
#> [1] "Bournemouth and Poole Teaching"
#> 
#> $region
#> [1] "South West"
#> 
#> $lsoa
#> [1] "Bournemouth 008C"
#> 
#> $msoa
#> [1] "Bournemouth 008"
#> 
#> $incode
#> [1] "9JW"
#> 
#> $outcode
#> [1] "BH8"
#> 
#> $parliamentary_constituency
#> [1] "Bournemouth East"
#> 
#> $parliamentary_constituency_2024
#> [1] "Bournemouth East"
#> 
#> $admin_district
#> [1] "Bournemouth, Christchurch and Poole"
#> 
#> $parish
#> [1] "Bournemouth, Christchurch and Poole, unparished area"
#> 
#> $admin_county
#> NULL
#> 
#> $date_of_introduction
#> [1] "198001"
#> 
#> $admin_ward
#> [1] "Queen's Park"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS Dorset"
#> 
#> $nuts
#> [1] "Bournemouth, Christchurch and Poole"
#> 
#> $pfa
#> [1] "Dorset"
#> 
#> $codes
#> $codes$admin_district
#> [1] "E06000058"
#> 
#> $codes$admin_county
#> [1] "E99999999"
#> 
#> $codes$admin_ward
#> [1] "E05012675"
#> 
#> $codes$parish
#> [1] "E43000261"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14001115"
#> 
#> $codes$parliamentary_constituency_2024
#> [1] "E14001115"
#> 
#> $codes$ccg
#> [1] "E38000045"
#> 
#> $codes$ccg_id
#> [1] "11J"
#> 
#> $codes$ced
#> [1] "E99999999"
#> 
#> $codes$nuts
#> [1] "TLK24"
#> 
#> $codes$lsoa
#> [1] "E01015340"
#> 
#> $codes$msoa
#> [1] "E02003179"
#> 
#> $codes$lau2
#> [1] "E06000058"
#> 
#> $codes$pfa
#> [1] "E23000039"
#> 
#> 
random_postcode("N1")
#> $postcode
#> [1] "N1 8BU"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 532022
#> 
#> $northings
#> [1] 183030
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "London"
#> 
#> $longitude
#> [1] -0.098104
#> 
#> $latitude
#> [1] 51.53075
#> 
#> $european_electoral_region
#> [1] "London"
#> 
#> $primary_care_trust
#> [1] "Islington"
#> 
#> $region
#> [1] "London"
#> 
#> $lsoa
#> [1] "Islington 020E"
#> 
#> $msoa
#> [1] "Islington 020"
#> 
#> $incode
#> [1] "8BU"
#> 
#> $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] "201505"
#> 
#> $admin_ward
#> [1] "St Peter's & Canalside"
#> 
#> $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] "E05013711"
#> 
#> $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] "E01002803"
#> 
#> $codes$msoa
#> [1] "E02000573"
#> 
#> $codes$lau2
#> [1] "E09000019"
#> 
#> $codes$pfa
#> [1] "E23000001"
#> 
#> 
# }