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] "DE5 3UB"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 440263
#> 
#> $northings
#> [1] 351696
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "East Midlands"
#> 
#> $longitude
#> [1] -1.400667
#> 
#> $latitude
#> [1] 53.061
#> 
#> $european_electoral_region
#> [1] "East Midlands"
#> 
#> $primary_care_trust
#> [1] "Derbyshire County"
#> 
#> $region
#> [1] "East Midlands"
#> 
#> $lsoa
#> [1] "Amber Valley 005E"
#> 
#> $msoa
#> [1] "Amber Valley 005"
#> 
#> $incode
#> [1] "3UB"
#> 
#> $outcode
#> [1] "DE5"
#> 
#> $parliamentary_constituency
#> [1] "Amber Valley"
#> 
#> $admin_district
#> [1] "Amber Valley"
#> 
#> $parish
#> [1] "Ripley"
#> 
#> $admin_county
#> [1] "Derbyshire"
#> 
#> $date_of_introduction
#> [1] "200704"
#> 
#> $admin_ward
#> [1] "Ripley"
#> 
#> $ced
#> [1] "Ripley East and Codnor"
#> 
#> $ccg
#> [1] "NHS Derby and Derbyshire"
#> 
#> $nuts
#> [1] "South and West Derbyshire"
#> 
#> $pfa
#> [1] "Derbyshire"
#> 
#> $codes
#> $codes$admin_district
#> [1] "E07000032"
#> 
#> $codes$admin_county
#> [1] "E10000007"
#> 
#> $codes$admin_ward
#> [1] "E05014703"
#> 
#> $codes$parish
#> [1] "E04002688"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14000533"
#> 
#> $codes$ccg
#> [1] "E38000261"
#> 
#> $codes$ccg_id
#> [1] "15M"
#> 
#> $codes$ced
#> [1] "E58000235"
#> 
#> $codes$nuts
#> [1] "TLF13"
#> 
#> $codes$lsoa
#> [1] "E01019456"
#> 
#> $codes$msoa
#> [1] "E02004033"
#> 
#> $codes$lau2
#> [1] "E07000032"
#> 
#> $codes$pfa
#> [1] "E23000018"
#> 
#> 
random_postcode("N1")
#> $postcode
#> [1] "N1 3HX"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 532982
#> 
#> $northings
#> [1] 184534
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "London"
#> 
#> $longitude
#> [1] -0.083705
#> 
#> $latitude
#> [1] 51.54404
#> 
#> $european_electoral_region
#> [1] "London"
#> 
#> $primary_care_trust
#> [1] "City and Hackney Teaching"
#> 
#> $region
#> [1] "London"
#> 
#> $lsoa
#> [1] "Hackney 021D"
#> 
#> $msoa
#> [1] "Hackney 021"
#> 
#> $incode
#> [1] "3HX"
#> 
#> $outcode
#> [1] "N1"
#> 
#> $parliamentary_constituency
#> [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] "De Beauvoir"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS North East London"
#> 
#> $nuts
#> [1] "Hackney and Newham"
#> 
#> $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] "E14000721"
#> 
#> $codes$ccg
#> [1] "E38000255"
#> 
#> $codes$ccg_id
#> [1] "A3A8R"
#> 
#> $codes$ced
#> [1] "E99999999"
#> 
#> $codes$nuts
#> [1] "TLI41"
#> 
#> $codes$lsoa
#> [1] "E01001751"
#> 
#> $codes$msoa
#> [1] "E02000365"
#> 
#> $codes$lau2
#> [1] "E09000012"
#> 
#> $codes$pfa
#> [1] "E23000001"
#> 
#> 
# }