Skip to contents

Fetch a data frame of all Westminster Parliamentary Constituencies for a given year and country based on the dfeR::wd_pcon_lad_la_rgn_ctry file

Usage

fetch_pcons(year = "All", countries = "All")

Arguments

year

year to filter the locations to, default is "All", options of 2017, 2019, 2020, 2021, 2022", 2023, 2024

countries

vector of desired countries to filter the locations to, default is "All", or can be a vector with options of "England", "Scotland", "Wales" or "Northern Ireland"

Value

data frame of unique location names and codes

Examples


# Using head() to show only top 5 rows for examples
head(fetch_wards())
#>   ward_code              ward_name
#> 1 E05001621               Bastwell
#> 2 E05001518                Ormesby
#> 3 E05008942            Burn Valley
#> 4 E05001622 Beardwood with Lammack
#> 5 E05008943               De Bruce
#> 6 E05001519           St Germain's

head(fetch_pcons())
#>   pcon_code      pcon_name
#> 1 E14000570      Blackburn
#> 2 E14000891         Redcar
#> 3 E14000733     Hartlepool
#> 4 E14000970 Stockton North
#> 5 E14000819  Middlesbrough
#> 6 E14000971 Stockton South

head(fetch_pcons(2023))
#>   pcon_code      pcon_name
#> 1 E14000570      Blackburn
#> 2 E14000891         Redcar
#> 3 E14000733     Hartlepool
#> 4 E14000970 Stockton North
#> 5 E14000819  Middlesbrough
#> 6 E14000971 Stockton South

head(fetch_pcons(countries = "Scotland"))
#>   pcon_code                 pcon_name
#> 1 S14000045                Midlothian
#> 2 S14000041 Kirkcaldy and Cowdenbeath
#> 3 S14000028                   Falkirk
#> 4 S14000036                Glenrothes
#> 5 S14000027      Na h-Eileanan an Iar
#> 6 S14000038                Inverclyde

head(fetch_pcons(year = 2023, countries = c("England", "Wales")))
#>   pcon_code      pcon_name
#> 1 E14000570      Blackburn
#> 2 E14000891         Redcar
#> 3 E14000733     Hartlepool
#> 4 E14000970 Stockton North
#> 5 E14000819  Middlesbrough
#> 6 E14000971 Stockton South

fetch_lads(2024, "Wales")
#>     lad_code          lad_name
#> 1  W06000001  Isle of Anglesey
#> 2  W06000002           Gwynedd
#> 3  W06000003             Conwy
#> 4  W06000011           Swansea
#> 5  W06000009     Pembrokeshire
#> 6  W06000006           Wrexham
#> 7  W06000004      Denbighshire
#> 8  W06000005        Flintshire
#> 9  W06000008        Ceredigion
#> 10 W06000010   Carmarthenshire
#> 11 W06000012 Neath Port Talbot
#> 12 W06000014 Vale of Glamorgan
#> 13 W06000022           Newport
#> 14 W06000023             Powys
#> 15 W06000020           Torfaen
#> 16 W06000016 Rhondda Cynon Taf
#> 17 W06000019     Blaenau Gwent
#> 18 W06000018        Caerphilly
#> 19 W06000021     Monmouthshire
#> 20 W06000013          Bridgend
#> 21 W06000015           Cardiff
#> 22 W06000024    Merthyr Tydfil

fetch_las(2022, "Northern Ireland")
#>    new_la_code                              la_name
#> 1    N09000003                              Belfast
#> 2    N09000004             Causeway Coast and Glens
#> 3    N09000002 Armagh City, Banbridge and Craigavon
#> 4    N09000005              Derry City and Strabane
#> 5    N09000001              Antrim and Newtownabbey
#> 6    N09000006                  Fermanagh and Omagh
#> 7    N09000008                  Mid and East Antrim
#> 8    N09000010               Newry, Mourne and Down
#> 9    N09000009                           Mid Ulster
#> 10   N09000011                  Ards and North Down
#> 11   N09000007              Lisburn and Castlereagh

# The following have no specific years available and return all values
fetch_regions()
#>    region_code                               region_name
#> 1    E12000001                                North East
#> 2    E12000002                                North West
#> 3    E12000003                  Yorkshire and The Humber
#> 4    E12000004                             East Midlands
#> 5    E12000005                             West Midlands
#> 6    E12000006                           East of England
#> 7    E12000007                                    London
#> 8    E12000008                                South East
#> 9    E12000009                                South West
#> 10   E13000001                              Inner London
#> 11   E13000002                              Outer London
#> 12           z            Outside of England and unknown
#> 13           z Outside of the United Kingdom and unknown
#> 14           z                        Outside of England
#> 15           z                 Outside of United Kingdom
#> 16           z                                   Unknown
fetch_countries()
#>    country_code                              country_name
#> 1     E92000001                                   England
#> 2     K02000001                            United Kingdom
#> 3     K03000001                             Great Britain
#> 4     K04000001                         England and Wales
#> 5     N92000002                          Northern Ireland
#> 6     S92000003                                  Scotland
#> 7     W92000004                                     Wales
#> 8             z       England, Wales and Northern Ireland
#> 9             z            Outside of England and unknown
#> 10            z Outside of the United Kingdom and unknown