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] "CW7 1GL"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 363358
#> 
#> $northings
#> [1] 365122
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "North West"
#> 
#> $longitude
#> [1] -2.549745
#> 
#> $latitude
#> [1] 53.18194
#> 
#> $european_electoral_region
#> [1] "North West"
#> 
#> $primary_care_trust
#> [1] "Central and Eastern Cheshire"
#> 
#> $region
#> [1] "North West"
#> 
#> $lsoa
#> [1] "Cheshire West and Chester 040C"
#> 
#> $msoa
#> [1] "Cheshire West and Chester 040"
#> 
#> $incode
#> [1] "1GL"
#> 
#> $outcode
#> [1] "CW7"
#> 
#> $parliamentary_constituency
#> [1] "Mid Cheshire"
#> 
#> $parliamentary_constituency_2024
#> [1] "Mid Cheshire"
#> 
#> $senedd_constituency
#> NULL
#> 
#> $senedd_constituency_no
#> NULL
#> 
#> $admin_district
#> [1] "Cheshire West and Chester"
#> 
#> $parish
#> [1] "Winsford"
#> 
#> $admin_county
#> NULL
#> 
#> $date_of_introduction
#> [1] "201709"
#> 
#> $date_of_termination
#> NULL
#> 
#> $index_of_multiple_deprivation
#> [1] 3611
#> 
#> $admin_ward
#> [1] "Winsford Over & Verdin"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS Cheshire and Merseyside"
#> 
#> $nuts
#> [1] "Cheshire West and Chester"
#> 
#> $pfa
#> [1] "Cheshire"
#> 
#> $nhs_region
#> [1] "North West"
#> 
#> $ttwa
#> [1] "Crewe"
#> 
#> $national_park
#> [1] "England (non-National Park)"
#> 
#> $bua
#> [1] "Winsford"
#> 
#> $icb
#> [1] "NHS Cheshire and Merseyside Integrated Care Board"
#> 
#> $cancer_alliance
#> [1] "Cheshire and Merseyside"
#> 
#> $lsoa11
#> [1] "Cheshire West and Chester 040C"
#> 
#> $msoa11
#> [1] "Cheshire West and Chester 040"
#> 
#> $lsoa21
#> [1] "Cheshire West and Chester 040C"
#> 
#> $msoa21
#> [1] "Cheshire West and Chester 040"
#> 
#> $oa21
#> [1] "E00188938"
#> 
#> $ruc11
#> [1] "(England/Wales) Urban city and town"
#> 
#> $ruc21
#> [1] "Urban: Further from a major town or city"
#> 
#> $lep1
#> [1] "Cheshire and Warrington"
#> 
#> $lep2
#> NULL
#> 
#> $codes
#> $codes$admin_district
#> [1] "E06000050"
#> 
#> $codes$admin_county
#> [1] "E99999999"
#> 
#> $codes$admin_ward
#> [1] "E05012250"
#> 
#> $codes$parish
#> [1] "E04011194"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14001361"
#> 
#> $codes$parliamentary_constituency_2024
#> [1] "E14001361"
#> 
#> $codes$ccg
#> [1] "E38000233"
#> 
#> $codes$ccg_id
#> [1] "27D"
#> 
#> $codes$ced
#> [1] "E99999999"
#> 
#> $codes$nuts
#> [1] "TLD63"
#> 
#> $codes$lsoa
#> [1] "E01018739"
#> 
#> $codes$msoa
#> [1] "E02003889"
#> 
#> $codes$lau2
#> [1] "E06000050"
#> 
#> $codes$pfa
#> [1] "E23000006"
#> 
#> $codes$nhs_region
#> [1] "E40000014"
#> 
#> $codes$ttwa
#> [1] "E30000197"
#> 
#> $codes$national_park
#> [1] "E65000001"
#> 
#> $codes$bua
#> [1] "E63008784"
#> 
#> $codes$icb
#> [1] "E54000008"
#> 
#> $codes$cancer_alliance
#> [1] "E56000005"
#> 
#> $codes$lsoa11
#> [1] "E01018739"
#> 
#> $codes$msoa11
#> [1] "E02003889"
#> 
#> $codes$lsoa21
#> [1] "E01018739"
#> 
#> $codes$msoa21
#> [1] "E02003889"
#> 
#> $codes$oa21
#> [1] "E00188938"
#> 
#> $codes$ruc11
#> [1] "C1"
#> 
#> $codes$ruc21
#> [1] "UF1"
#> 
#> $codes$lep1
#> [1] "E37000003"
#> 
#> $codes$lep2
#> NULL
#> 
#> 
random_postcode("N1")
#> $postcode
#> [1] "N1 0AP"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 530344
#> 
#> $northings
#> [1] 184010
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "London"
#> 
#> $longitude
#> [1] -0.121893
#> 
#> $latitude
#> [1] 51.53995
#> 
#> $european_electoral_region
#> [1] "London"
#> 
#> $primary_care_trust
#> [1] "Islington"
#> 
#> $region
#> [1] "London"
#> 
#> $lsoa
#> [1] "Islington 015A"
#> 
#> $msoa
#> [1] "Islington 015"
#> 
#> $incode
#> [1] "0AP"
#> 
#> $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] "Islington"
#> 
#> $parish
#> [1] "Islington, unparished area"
#> 
#> $admin_county
#> NULL
#> 
#> $date_of_introduction
#> [1] "198001"
#> 
#> $date_of_termination
#> NULL
#> 
#> $index_of_multiple_deprivation
#> [1] 8035
#> 
#> $admin_ward
#> [1] "Caledonian"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS West and North London"
#> 
#> $nuts
#> [1] "Islington"
#> 
#> $pfa
#> [1] "Metropolitan Police"
#> 
#> $nhs_region
#> [1] "London"
#> 
#> $ttwa
#> [1] "London"
#> 
#> $national_park
#> [1] "England (non-National Park)"
#> 
#> $bua
#> [1] "Islington"
#> 
#> $icb
#> [1] "NHS West and North London Integrated Care Board"
#> 
#> $cancer_alliance
#> [1] "North Central London"
#> 
#> $lsoa11
#> [1] "Islington 015A"
#> 
#> $msoa11
#> [1] "Islington 015"
#> 
#> $lsoa21
#> [1] "Islington 015A"
#> 
#> $msoa21
#> [1] "Islington 015"
#> 
#> $oa21
#> [1] "E00183722"
#> 
#> $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] "E09000019"
#> 
#> $codes$admin_county
#> [1] "E99999999"
#> 
#> $codes$admin_ward
#> [1] "E05013700"
#> 
#> $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] "E01002708"
#> 
#> $codes$msoa
#> [1] "E02000568"
#> 
#> $codes$lau2
#> [1] "E09000019"
#> 
#> $codes$pfa
#> [1] "E23000001"
#> 
#> $codes$nhs_region
#> [1] "E40000003"
#> 
#> $codes$ttwa
#> [1] "E30000234"
#> 
#> $codes$national_park
#> [1] "E65000001"
#> 
#> $codes$bua
#> [1] "E63011980"
#> 
#> $codes$icb
#> [1] "E54000071"
#> 
#> $codes$cancer_alliance
#> [1] "E56000027"
#> 
#> $codes$lsoa11
#> [1] "E01002708"
#> 
#> $codes$msoa11
#> [1] "E02000568"
#> 
#> $codes$lsoa21
#> [1] "E01002708"
#> 
#> $codes$msoa21
#> [1] "E02000568"
#> 
#> $codes$oa21
#> [1] "E00183722"
#> 
#> $codes$ruc11
#> [1] "A1"
#> 
#> $codes$ruc21
#> [1] "UN1"
#> 
#> $codes$lep1
#> [1] "E37000051"
#> 
#> $codes$lep2
#> NULL
#> 
#> 
# }