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] "HA1 4XD"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 514902
#> 
#> $northings
#> [1] 189167
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "London"
#> 
#> $longitude
#> [1] -0.342769
#> 
#> $latitude
#> [1] 51.58965
#> 
#> $european_electoral_region
#> [1] "London"
#> 
#> $primary_care_trust
#> [1] "Harrow"
#> 
#> $region
#> [1] "London"
#> 
#> $lsoa
#> [1] "Harrow 020C"
#> 
#> $msoa
#> [1] "Harrow 020"
#> 
#> $incode
#> [1] "4XD"
#> 
#> $outcode
#> [1] "HA1"
#> 
#> $parliamentary_constituency
#> [1] "Harrow West"
#> 
#> $parliamentary_constituency_2024
#> [1] "Harrow West"
#> 
#> $senedd_constituency
#> NULL
#> 
#> $senedd_constituency_no
#> NULL
#> 
#> $admin_district
#> [1] "Harrow"
#> 
#> $parish
#> [1] "Harrow, unparished area"
#> 
#> $admin_county
#> NULL
#> 
#> $date_of_introduction
#> [1] "198001"
#> 
#> $date_of_termination
#> NULL
#> 
#> $index_of_multiple_deprivation
#> [1] 21668
#> 
#> $admin_ward
#> [1] "Marlborough"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS West and North London"
#> 
#> $nuts
#> [1] "Harrow"
#> 
#> $pfa
#> [1] "Metropolitan Police"
#> 
#> $nhs_region
#> [1] "London"
#> 
#> $ttwa
#> [1] "London"
#> 
#> $national_park
#> [1] "England (non-National Park)"
#> 
#> $bua
#> [1] "Harrow"
#> 
#> $icb
#> [1] "NHS West and North London Integrated Care Board"
#> 
#> $cancer_alliance
#> [1] "West London"
#> 
#> $lsoa11
#> [1] "Harrow 020C"
#> 
#> $msoa11
#> [1] "Harrow 020"
#> 
#> $lsoa21
#> [1] "Harrow 020C"
#> 
#> $msoa21
#> [1] "Harrow 020"
#> 
#> $oa21
#> [1] "E00010913"
#> 
#> $ruc11
#> [1] "(England/Wales) Urban major conurbation"
#> 
#> $ruc21
#> [1] "Urban: Nearer to a major town or city"
#> 
#> $lep1
#> [1] "London"
#> 
#> $lep2
#> NULL
#> 
#> $codes
#> $codes$admin_district
#> [1] "E09000015"
#> 
#> $codes$admin_county
#> [1] "E99999999"
#> 
#> $codes$admin_ward
#> [1] "E05013553"
#> 
#> $codes$parish
#> [1] "E43000205"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14001271"
#> 
#> $codes$parliamentary_constituency_2024
#> [1] "E14001271"
#> 
#> $codes$ccg
#> [1] "E38000256"
#> 
#> $codes$ccg_id
#> [1] "W2U3Z"
#> 
#> $codes$ced
#> [1] "E99999999"
#> 
#> $codes$nuts
#> [1] "TLI74"
#> 
#> $codes$lsoa
#> [1] "E01002181"
#> 
#> $codes$msoa
#> [1] "E02000452"
#> 
#> $codes$lau2
#> [1] "E09000015"
#> 
#> $codes$pfa
#> [1] "E23000001"
#> 
#> $codes$nhs_region
#> [1] "E40000003"
#> 
#> $codes$ttwa
#> [1] "E30000234"
#> 
#> $codes$national_park
#> [1] "E65000001"
#> 
#> $codes$bua
#> [1] "E63011900"
#> 
#> $codes$icb
#> [1] "E54000071"
#> 
#> $codes$cancer_alliance
#> [1] "E56000021"
#> 
#> $codes$lsoa11
#> [1] "E01002181"
#> 
#> $codes$msoa11
#> [1] "E02000452"
#> 
#> $codes$lsoa21
#> [1] "E01002181"
#> 
#> $codes$msoa21
#> [1] "E02000452"
#> 
#> $codes$oa21
#> [1] "E00010913"
#> 
#> $codes$ruc11
#> [1] "A1"
#> 
#> $codes$ruc21
#> [1] "UN1"
#> 
#> $codes$lep1
#> [1] "E37000051"
#> 
#> $codes$lep2
#> NULL
#> 
#> 
random_postcode("N1")
#> $postcode
#> [1] "N1 5SU"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 533203
#> 
#> $northings
#> [1] 183850
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "London"
#> 
#> $longitude
#> [1] -0.080752
#> 
#> $latitude
#> [1] 51.53784
#> 
#> $european_electoral_region
#> [1] "London"
#> 
#> $primary_care_trust
#> [1] "City and Hackney Teaching"
#> 
#> $region
#> [1] "London"
#> 
#> $lsoa
#> [1] "Hackney 031D"
#> 
#> $msoa
#> [1] "Hackney 031"
#> 
#> $incode
#> [1] "5SU"
#> 
#> $outcode
#> [1] "N1"
#> 
#> $parliamentary_constituency
#> [1] "Islington South and Finsbury"
#> 
#> $parliamentary_constituency_2024
#> [1] "Islington South and Finsbury"
#> 
#> $senedd_constituency
#> NULL
#> 
#> $senedd_constituency_no
#> NULL
#> 
#> $admin_district
#> [1] "Hackney"
#> 
#> $parish
#> [1] "Hackney, unparished area"
#> 
#> $admin_county
#> NULL
#> 
#> $date_of_introduction
#> [1] "198001"
#> 
#> $date_of_termination
#> NULL
#> 
#> $index_of_multiple_deprivation
#> [1] 5518
#> 
#> $admin_ward
#> [1] "De Beauvoir"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS North East London"
#> 
#> $nuts
#> [1] "Hackney"
#> 
#> $pfa
#> [1] "Metropolitan Police"
#> 
#> $nhs_region
#> [1] "London"
#> 
#> $ttwa
#> [1] "London"
#> 
#> $national_park
#> [1] "England (non-National Park)"
#> 
#> $bua
#> [1] "Hackney"
#> 
#> $icb
#> [1] "NHS North East London Integrated Care Board"
#> 
#> $cancer_alliance
#> [1] "North East London"
#> 
#> $lsoa11
#> [1] "Hackney 021C"
#> 
#> $msoa11
#> [1] "Hackney 021"
#> 
#> $lsoa21
#> [1] "Hackney 031D"
#> 
#> $msoa21
#> [1] "Hackney 031"
#> 
#> $oa21
#> [1] "E00183997"
#> 
#> $ruc11
#> [1] "(England/Wales) Urban major conurbation"
#> 
#> $ruc21
#> [1] "Urban: Nearer to a major town or city"
#> 
#> $lep1
#> [1] "London"
#> 
#> $lep2
#> NULL
#> 
#> $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] "E01001750"
#> 
#> $codes$msoa
#> [1] "E02007109"
#> 
#> $codes$lau2
#> [1] "E09000012"
#> 
#> $codes$pfa
#> [1] "E23000001"
#> 
#> $codes$nhs_region
#> [1] "E40000003"
#> 
#> $codes$ttwa
#> [1] "E30000234"
#> 
#> $codes$national_park
#> [1] "E65000001"
#> 
#> $codes$bua
#> [1] "E63011969"
#> 
#> $codes$icb
#> [1] "E54000029"
#> 
#> $codes$cancer_alliance
#> [1] "E56000028"
#> 
#> $codes$lsoa11
#> [1] "E01001750"
#> 
#> $codes$msoa11
#> [1] "E02000365"
#> 
#> $codes$lsoa21
#> [1] "E01001750"
#> 
#> $codes$msoa21
#> [1] "E02007109"
#> 
#> $codes$oa21
#> [1] "E00183997"
#> 
#> $codes$ruc11
#> [1] "A1"
#> 
#> $codes$ruc21
#> [1] "UN1"
#> 
#> $codes$lep1
#> [1] "E37000051"
#> 
#> $codes$lep2
#> NULL
#> 
#> 
# }