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] "RG28 7FH"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 446406
#> 
#> $northings
#> [1] 147582
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "South Central"
#> 
#> $longitude
#> [1] -1.336815
#> 
#> $latitude
#> [1] 51.22555
#> 
#> $european_electoral_region
#> [1] "South East"
#> 
#> $primary_care_trust
#> [1] "Hampshire"
#> 
#> $region
#> [1] "South East"
#> 
#> $lsoa
#> [1] "Basingstoke and Deane 020C"
#> 
#> $msoa
#> [1] "Basingstoke and Deane 020"
#> 
#> $incode
#> [1] "7FH"
#> 
#> $outcode
#> [1] "RG28"
#> 
#> $parliamentary_constituency
#> [1] "North West Hampshire"
#> 
#> $admin_district
#> [1] "Basingstoke and Deane"
#> 
#> $parish
#> [1] "Whitchurch"
#> 
#> $admin_county
#> [1] "Hampshire"
#> 
#> $admin_ward
#> [1] "Whitchurch, Overton & Laverstoke"
#> 
#> $ced
#> [1] "Whitchurch & The Cleres"
#> 
#> $ccg
#> [1] "NHS Hampshire, Southampton and Isle of Wight"
#> 
#> $nuts
#> [1] "North Hampshire"
#> 
#> $codes
#> $codes$admin_district
#> [1] "E07000084"
#> 
#> $codes$admin_county
#> [1] "E10000014"
#> 
#> $codes$admin_ward
#> [1] "E05013094"
#> 
#> $codes$parish
#> [1] "E04004486"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14000857"
#> 
#> $codes$ccg
#> [1] "E38000253"
#> 
#> $codes$ccg_id
#> [1] "D9Y0V"
#> 
#> $codes$ced
#> [1] "E58000594"
#> 
#> $codes$nuts
#> [1] "TLJ37"
#> 
#> $codes$lsoa
#> [1] "E01022564"
#> 
#> $codes$msoa
#> [1] "E02004694"
#> 
#> $codes$lau2
#> [1] "E07000084"
#> 
#> 
random_postcode("N1")
#> $postcode
#> [1] "N1 5AZ"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 533448
#> 
#> $northings
#> [1] 184149
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "London"
#> 
#> $longitude
#> [1] -0.077135
#> 
#> $latitude
#> [1] 51.54047
#> 
#> $european_electoral_region
#> [1] "London"
#> 
#> $primary_care_trust
#> [1] "City and Hackney Teaching"
#> 
#> $region
#> [1] "London"
#> 
#> $lsoa
#> [1] "Hackney 021C"
#> 
#> $msoa
#> [1] "Hackney 021"
#> 
#> $incode
#> [1] "5AZ"
#> 
#> $outcode
#> [1] "N1"
#> 
#> $parliamentary_constituency
#> [1] "Hackney South and Shoreditch"
#> 
#> $admin_district
#> [1] "Hackney"
#> 
#> $parish
#> [1] "Hackney, unparished area"
#> 
#> $admin_county
#> NULL
#> 
#> $admin_ward
#> [1] "De Beauvoir"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS North East London"
#> 
#> $nuts
#> [1] "Hackney and Newham"
#> 
#> $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] "E01001750"
#> 
#> $codes$msoa
#> [1] "E02000365"
#> 
#> $codes$lau2
#> [1] "E09000012"
#> 
#> 
# }