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] "PO19 1BX"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 486008
#> 
#> $northings
#> [1] 105116
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "South East Coast"
#> 
#> $longitude
#> [1] -0.779868
#> 
#> $latitude
#> [1] 50.83918
#> 
#> $european_electoral_region
#> [1] "South East"
#> 
#> $primary_care_trust
#> [1] "West Sussex"
#> 
#> $region
#> [1] "South East"
#> 
#> $lsoa
#> [1] "Chichester 010D"
#> 
#> $msoa
#> [1] "Chichester 010"
#> 
#> $incode
#> [1] "1BX"
#> 
#> $outcode
#> [1] "PO19"
#> 
#> $parliamentary_constituency
#> [1] "Chichester"
#> 
#> $parliamentary_constituency_2024
#> [1] "Chichester"
#> 
#> $admin_district
#> [1] "Chichester"
#> 
#> $parish
#> [1] "Chichester"
#> 
#> $admin_county
#> [1] "West Sussex"
#> 
#> $date_of_introduction
#> [1] "198001"
#> 
#> $admin_ward
#> [1] "Chichester Central"
#> 
#> $ced
#> [1] "Chichester South"
#> 
#> $ccg
#> [1] "NHS Sussex"
#> 
#> $nuts
#> [1] "Chichester"
#> 
#> $pfa
#> [1] "Sussex"
#> 
#> $codes
#> $codes$admin_district
#> [1] "E07000225"
#> 
#> $codes$admin_county
#> [1] "E10000032"
#> 
#> $codes$admin_ward
#> [1] "E05011666"
#> 
#> $codes$parish
#> [1] "E04009888"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14001166"
#> 
#> $codes$parliamentary_constituency_2024
#> [1] "E14001166"
#> 
#> $codes$ccg
#> [1] "E38000265"
#> 
#> $codes$ccg_id
#> [1] "70F"
#> 
#> $codes$ced
#> [1] "E58001615"
#> 
#> $codes$nuts
#> [1] "TLJ27"
#> 
#> $codes$lsoa
#> [1] "E01031490"
#> 
#> $codes$msoa
#> [1] "E02006570"
#> 
#> $codes$lau2
#> [1] "E07000225"
#> 
#> $codes$pfa
#> [1] "E23000033"
#> 
#> 
random_postcode("N1")
#> $postcode
#> [1] "N1 3HA"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 532988
#> 
#> $northings
#> [1] 184789
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "London"
#> 
#> $longitude
#> [1] -0.083496
#> 
#> $latitude
#> [1] 51.54633
#> 
#> $european_electoral_region
#> [1] "London"
#> 
#> $primary_care_trust
#> [1] "City and Hackney Teaching"
#> 
#> $region
#> [1] "London"
#> 
#> $lsoa
#> [1] "Hackney 021E"
#> 
#> $msoa
#> [1] "Hackney 021"
#> 
#> $incode
#> [1] "3HA"
#> 
#> $outcode
#> [1] "N1"
#> 
#> $parliamentary_constituency
#> [1] "Islington South and Finsbury"
#> 
#> $parliamentary_constituency_2024
#> [1] "Islington South and Finsbury"
#> 
#> $admin_district
#> [1] "Hackney"
#> 
#> $parish
#> [1] "Hackney, unparished area"
#> 
#> $admin_county
#> NULL
#> 
#> $date_of_introduction
#> [1] "200112"
#> 
#> $admin_ward
#> [1] "De Beauvoir"
#> 
#> $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] "E05009371"
#> 
#> $codes$parish
#> [1] "E43000202"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14001306"
#> 
#> $codes$parliamentary_constituency_2024
#> [1] "E14001306"
#> 
#> $codes$ccg
#> [1] "E38000255"
#> 
#> $codes$ccg_id
#> [1] "A3A8R"
#> 
#> $codes$ced
#> [1] "E99999999"
#> 
#> $codes$nuts
#> [1] "TLI41"
#> 
#> $codes$lsoa
#> [1] "E01001756"
#> 
#> $codes$msoa
#> [1] "E02000365"
#> 
#> $codes$lau2
#> [1] "E09000012"
#> 
#> $codes$pfa
#> [1] "E23000001"
#> 
#> 
# }