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] "EX16 8AU"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 280439
#> 
#> $northings
#> [1] 114347
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "South West"
#> 
#> $longitude
#> [1] -3.702214
#> 
#> $latitude
#> [1] 50.91616
#> 
#> $european_electoral_region
#> [1] "South West"
#> 
#> $primary_care_trust
#> [1] "Devon"
#> 
#> $region
#> [1] "South West"
#> 
#> $lsoa
#> [1] "North Devon 014C"
#> 
#> $msoa
#> [1] "North Devon 014"
#> 
#> $incode
#> [1] "8AU"
#> 
#> $outcode
#> [1] "EX16"
#> 
#> $parliamentary_constituency
#> [1] "North Devon"
#> 
#> $parliamentary_constituency_2024
#> [1] "North Devon"
#> 
#> $admin_district
#> [1] "North Devon"
#> 
#> $parish
#> [1] "Witheridge"
#> 
#> $admin_county
#> [1] "Devon"
#> 
#> $date_of_introduction
#> [1] "198001"
#> 
#> $admin_ward
#> [1] "Witheridge"
#> 
#> $ced
#> [1] "South Molton"
#> 
#> $ccg
#> [1] "NHS Devon"
#> 
#> $nuts
#> [1] "North Devon"
#> 
#> $pfa
#> [1] "Devon & Cornwall"
#> 
#> $nhs_region
#> [1] "South West"
#> 
#> $ttwa
#> [1] "Barnstaple"
#> 
#> $national_park
#> [1] "England (non-National Park)"
#> 
#> $bua
#> [1] "Witheridge"
#> 
#> $icb
#> [1] "NHS Devon Integrated Care Board"
#> 
#> $cancer_alliance
#> [1] "Peninsula"
#> 
#> $lsoa11
#> [1] "North Devon 014C"
#> 
#> $msoa11
#> [1] "North Devon 014"
#> 
#> $lsoa21
#> [1] "North Devon 014C"
#> 
#> $msoa21
#> [1] "North Devon 014"
#> 
#> $oa21
#> [1] "E00101976"
#> 
#> $ruc11
#> [1] "(England/Wales) Rural town and fringe in a sparse setting"
#> 
#> $ruc21
#> [1] "Larger rural: Further from a major town or city"
#> 
#> $lep1
#> [1] "Heart of the South West"
#> 
#> $lep2
#> NULL
#> 
#> $codes
#> $codes$admin_district
#> [1] "E07000043"
#> 
#> $codes$admin_county
#> [1] "E10000008"
#> 
#> $codes$admin_ward
#> [1] "E05012436"
#> 
#> $codes$parish
#> [1] "E04003128"
#> 
#> $codes$parliamentary_constituency
#> [1] "E14001387"
#> 
#> $codes$parliamentary_constituency_2024
#> [1] "E14001387"
#> 
#> $codes$ccg
#> [1] "E38000230"
#> 
#> $codes$ccg_id
#> [1] "15N"
#> 
#> $codes$ced
#> [1] "E58000298"
#> 
#> $codes$nuts
#> [1] "TLK43"
#> 
#> $codes$lsoa
#> [1] "E01020138"
#> 
#> $codes$msoa
#> [1] "E02004188"
#> 
#> $codes$lau2
#> [1] "E07000043"
#> 
#> $codes$pfa
#> [1] "E23000035"
#> 
#> $codes$nhs_region
#> [1] "E40000006"
#> 
#> $codes$ttwa
#> [1] "E30000162"
#> 
#> $codes$national_park
#> [1] "E65000001"
#> 
#> $codes$bua
#> [1] "E63013513"
#> 
#> $codes$icb
#> [1] "E54000037"
#> 
#> $codes$cancer_alliance
#> [1] "E56000014"
#> 
#> $codes$lsoa11
#> [1] "E01020138"
#> 
#> $codes$msoa11
#> [1] "E02004188"
#> 
#> $codes$lsoa21
#> [1] "E01020138"
#> 
#> $codes$msoa21
#> [1] "E02004188"
#> 
#> $codes$oa21
#> [1] "E00101976"
#> 
#> $codes$ruc11
#> [1] "D2"
#> 
#> $codes$ruc21
#> [1] "RLF1"
#> 
#> $codes$lep1
#> [1] "E37000016"
#> 
#> $codes$lep2
#> NULL
#> 
#> 
random_postcode("N1")
#> $postcode
#> [1] "N1 0UA"
#> 
#> $quality
#> [1] 1
#> 
#> $eastings
#> [1] 530590
#> 
#> $northings
#> [1] 183657
#> 
#> $country
#> [1] "England"
#> 
#> $nhs_ha
#> [1] "London"
#> 
#> $longitude
#> [1] -0.118478
#> 
#> $latitude
#> [1] 51.53672
#> 
#> $european_electoral_region
#> [1] "London"
#> 
#> $primary_care_trust
#> [1] "Islington"
#> 
#> $region
#> [1] "London"
#> 
#> $lsoa
#> [1] "Islington 019D"
#> 
#> $msoa
#> [1] "Islington 019"
#> 
#> $incode
#> [1] "0UA"
#> 
#> $outcode
#> [1] "N1"
#> 
#> $parliamentary_constituency
#> [1] "Islington South and Finsbury"
#> 
#> $parliamentary_constituency_2024
#> [1] "Islington South and Finsbury"
#> 
#> $admin_district
#> [1] "Islington"
#> 
#> $parish
#> [1] "Islington, unparished area"
#> 
#> $admin_county
#> NULL
#> 
#> $date_of_introduction
#> [1] "198001"
#> 
#> $admin_ward
#> [1] "Caledonian"
#> 
#> $ced
#> NULL
#> 
#> $ccg
#> [1] "NHS North Central 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 North Central London Integrated Care Board"
#> 
#> $cancer_alliance
#> [1] "North Central London"
#> 
#> $lsoa11
#> [1] "Islington 019D"
#> 
#> $msoa11
#> [1] "Islington 019"
#> 
#> $lsoa21
#> [1] "Islington 019D"
#> 
#> $msoa21
#> [1] "Islington 019"
#> 
#> $oa21
#> [1] "E00013482"
#> 
#> $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] "E01002710"
#> 
#> $codes$msoa
#> [1] "E02000572"
#> 
#> $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] "E54000028"
#> 
#> $codes$cancer_alliance
#> [1] "E56000027"
#> 
#> $codes$lsoa11
#> [1] "E01002710"
#> 
#> $codes$msoa11
#> [1] "E02000572"
#> 
#> $codes$lsoa21
#> [1] "E01002710"
#> 
#> $codes$msoa21
#> [1] "E02000572"
#> 
#> $codes$oa21
#> [1] "E00013482"
#> 
#> $codes$ruc11
#> [1] "A1"
#> 
#> $codes$ruc21
#> [1] "UN1"
#> 
#> $codes$lep1
#> [1] "E37000051"
#> 
#> $codes$lep2
#> NULL
#> 
#> 
# }