Social Vulnerability Ireland - Subet vulnerability results#

Environment#

R Libraries#

The relvant R libraries are imported in to the kernal:

# Load R libraries
if(!require("pacman"))
    install.packages("pacman")

p_load("sf", "tidyverse")

print("Loaded Packages:")
p_loaded()
Loading required package: pacman
[1] "Loaded Packages:"
  1. 'lubridate'
  2. 'forcats'
  3. 'stringr'
  4. 'dplyr'
  5. 'purrr'
  6. 'readr'
  7. 'tidyr'
  8. 'tibble'
  9. 'ggplot2'
  10. 'tidyverse'
  11. 'sf'
  12. 'pacman'

Output directory#

# create the output directory if it does not exist
output_dir <- file.path("../..","3_outputs","Ireland","2022","Cork")
if(!dir.exists(output_dir)){
    dir.create(output_dir, recursive = TRUE)
    print(paste0(output_dir, " created"))
}

Set the GUID#

GUID <- "SA_GUID__1"

Load Data#

Import the data#

# Load Social Vulnerability Index data
svi_input <- st_read("../../3_outputs/Ireland/2022/social_vulnerability_index_ireland_2022.geojson")
head(svi_input)

# Load census output areas
census_areas <- st_read("../../0_data/boundaries/Ireland/census_small_areas/2022/SMALL_AREA_2022.shp")
head(census_areas)
Reading layer `social_vulnerability_index_ireland_2022' from data source 
  `/Cities/3_outputs/Ireland/2022/social_vulnerability_index_ireland_2022.geojson' 
  using driver `GeoJSON'
Simple feature collection with 18919 features and 46 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 417471.5 ymin: 519663.7 xmax: 734481.1 ymax: 966896.3
Projected CRS: IRENET95 / Irish Transverse Mercator
Registered S3 method overwritten by 'geojsonsf':
  method        from   
  print.geojson geojson
A sf: 6 × 47
SA_GUID__1early_childhoodage_middle_to_oldest_oldpoor_healthdisabilityone_parent_householdsthree_or_more_children_householdslow_skilled_employmentfarmersunemploymentgeometryhousing_characteristicsphysical_environmentsensitivitypreparerespondrecoveradaptive_capacityenhanced_exposuresocial_vulnerabilitygeometry
<chr><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><MULTIPOLYGON [m]>
1000581a3-4ebd-4a74-b5f8-0bd78cd7ede5 3.3880435-0.8683184-0.72494112-0.92235833-0.9537932-0.28864382-0.3191812-0.5775435-0.61650259MULTIPOLYGON (((676048.9 72...-0.51537733 0.2163239 0.38290372-0.4856123-0.3377139-1.3729086-0.61316276-0.3497016-0.33398100MULTIPOLYGON (((676048.9 72...
200275248-3d78-4fdb-8e5c-8ff1f76aebea-1.2041476 1.0830212 0.27801178-0.62611003-0.5813707 0.24855343-0.7175350 0.2814244-0.23523246MULTIPOLYGON (((637187.3 72...-0.08272206-0.1150856-0.20594059-1.0185818-0.9052009-0.5397312-1.02866162-0.2313086-0.93275401MULTIPOLYGON (((637187.3 72...
3002b83e4-5cce-414a-8570-871a50ae0964 0.2940109-0.6563918 0.07647292 0.06773408 0.3083236-0.06192013-0.7370951-0.1126775 0.22240140MULTIPOLYGON (((645674.5 69...-0.43095487 0.3196619-0.09575557 1.3659655 1.7874752-0.1097374 1.32022239-0.1301417 1.13569837MULTIPOLYGON (((645674.5 69...
4005eec3f-d746-480f-ae2c-bc6f1151548d-1.3337162 1.4547264 0.49313225 0.45603900-1.0918818-1.18351563-1.9157382-0.5775435-0.07660151MULTIPOLYGON (((716705.1 72...-0.34810226 0.6397246 0.46969785 1.3940082 0.8307672-0.3008060 0.88678611 0.3410119 1.02930797MULTIPOLYGON (((716705.1 72...
500b00ae4-229d-455d-84f1-d6face4876b1 1.7131001-1.2060316-0.32805634-0.03080027 3.2416831 1.26642096 1.5271694-0.5775435 0.75768133MULTIPOLYGON (((697195.3 79...-0.57973227 0.4764065 0.06504954 1.1356657-0.5626938-0.3603958 0.06607222-0.1208251 0.19607516MULTIPOLYGON (((697195.3 79...
600df2b78-66c8-4009-89e0-0e14e15e4208 1.5084163-0.8589597-1.03118100-1.02730679-0.4959203-0.57201990 0.4816479-0.4599295-0.97841257MULTIPOLYGON (((662960.4 71...-0.50830359 0.1858483-0.61841747-0.5434782 0.5417954-1.2756320 0.04443066-0.3770668-0.09735021MULTIPOLYGON (((662960.4 71...
Reading layer `SMALL_AREA_2022' from data source 
  `/Cities/0_data/boundaries/Ireland/census_small_areas/2022/SMALL_AREA_2022.shp' 
  using driver `ESRI Shapefile'
Simple feature collection with 18919 features and 28 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 417471.5 ymin: 519663.7 xmax: 734481.1 ymax: 966896.3
Projected CRS: IRENET95 / Irish Transverse Mercator
A sf: 6 × 29
OBJECTIDSA_GUID_20SA_GUID__1SA_PUB2011SA_PUB2016SA_PUB2022SA_GEOGID_SA_CHANGE_SA_URBAN_ASA_URBAN_1geometryED_GAEILGEED_ID_STRED_PART_COCOUNTY_CODCOUNTY_ENGCOUNTY_GAECSO_LEASHAPE_LengSHAPE_Areageometry
<int><chr><chr><chr><chr><chr><chr><int><int><chr><chr><chr><int><chr><chr><chr><chr><dbl><dbl><MULTIPOLYGON [m]>
114c07d11e-0a4f-851d-e053-ca3ca8c0ca7f4c07d11e-0a4f-851d-e053-ca3ca8c0ca7f017010016017010016017010016A01701001601CarlowMULTIPOLYGON (((673146.5 67...CEATHARLACH (TUATH)017010101CARLOWCeatharlachCARLOW2123.346204944.2MULTIPOLYGON (((673146.5 67...
224c07d11e-0a3a-851d-e053-ca3ca8c0ca7f4c07d11e-0a3a-851d-e053-ca3ca8c0ca7f017010046017010046017010046A01701004641CarlowMULTIPOLYGON (((673956.3 67...CEATHARLACH (TUATH)017010101CARLOWCeatharlachCARLOW2891.271288225.4MULTIPOLYGON (((673956.3 67...
334c07d11e-0a4e-851d-e053-ca3ca8c0ca7f4c07d11e-0a4e-851d-e053-ca3ca8c0ca7f017010037017010037017010037A01701003701CarlowMULTIPOLYGON (((673720.6 67...CEATHARLACH (TUATH)017010101CARLOWCeatharlachCARLOW2436.986208426.9MULTIPOLYGON (((673720.6 67...
444c07d11e-0a25-851d-e053-ca3ca8c0ca7f4c07d11e-0a25-851d-e053-ca3ca8c0ca7f017010005017010005017010005A01701000501CarlowMULTIPOLYGON (((671923.3 67...CEATHARLACH (TUATH)017010101CARLOWCeatharlachCARLOW2887.091348798.6MULTIPOLYGON (((671923.3 67...
554c07d11e-0a57-851d-e053-ca3ca8c0ca7f4c07d11e-0a57-851d-e053-ca3ca8c0ca7f017010036017010036017010036A01701003601CarlowMULTIPOLYGON (((673711.8 67...CEATHARLACH (TUATH)017010101CARLOWCeatharlachCARLOW2844.410429349.1MULTIPOLYGON (((673711.8 67...
664c07d11e-2df2-851d-e053-ca3ca8c0ca7f4c07d11e-2df2-851d-e053-ca3ca8c0ca7f017010009017010009017010009A01701000941CarlowMULTIPOLYGON (((673488.5 67...CEATHARLACH (TUATH)017010101CARLOWCeatharlachCARLOW1058.290 59299.2MULTIPOLYGON (((673488.5 67...

Filter Data#

# Merge  the Social Vulnerability Index data and the census areas
merged_data <- merge(st_drop_geometry(svi_input), st_drop_geometry(census_areas), by = GUID)

# Filter Cork data (Cork city and suburbs code is "17", the rest of county Cork code is "18")
merged_data_cork <- merged_data %>% filter(COUNTY_COD == "17" | COUNTY_COD == "18")
merged_data_cork_ids <- merged_data_cork[,GUID]

svi_output_cork <- svi_input %>% filter(!!as.symbol(GUID) %in% merged_data_cork_ids)
nrow(svi_output_cork)
head(svi_output_cork)
2206
A sf: 6 × 47
SA_GUID__1early_childhoodage_middle_to_oldest_oldpoor_healthdisabilityone_parent_householdsthree_or_more_children_householdslow_skilled_employmentfarmersunemploymentgeometryhousing_characteristicsphysical_environmentsensitivitypreparerespondrecoveradaptive_capacityenhanced_exposuresocial_vulnerabilitygeometry
<chr><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><MULTIPOLYGON [m]>
104fa3a14-afbe-4e99-a760-f209f50d156e-0.1751081 0.90022941-0.6374113 1.0354936-0.4338410-1.0229980-1.0620197 0.8259487 1.7070003MULTIPOLYGON (((498746.1 53... 1.17139451-1.90814855 0.49296903 0.06113257-0.05771688 1.23755431 0.2211145-0.86153177-0.1661047MULTIPOLYGON (((498746.1 53...
2056f5166-a6a5-45aa-99c2-bd4e5ecab938 0.8945241 0.09879282-0.1675958-0.5858810-0.3856101-0.4588344 0.2712924-0.5775435 0.3593869MULTIPOLYGON (((545906.9 57... 0.28067781 0.09097864 0.10526478-0.56876794-0.80338394-0.20154873-0.5886800 0.43460072-0.4278078MULTIPOLYGON (((545906.9 57...
306192d69-db1b-49af-b03e-8067305ba789 0.6718825-0.20471071-0.5854947 0.4152686 0.7336784-0.7301653 0.6393685-0.3244177-0.3158771MULTIPOLYGON (((570586.2 61...-0.03881498 0.14975495 0.13032809 0.66595662 0.34384632 0.09718817 0.4813834 0.12972893 0.4712041MULTIPOLYGON (((570586.2 61...
40642d55d-8404-4fcf-8fc0-5e7ce85e11d8 4.2077987-1.21257418-1.2695713-1.5866988-1.2516686-0.6761514-0.8403841-0.5775435-2.1269721MULTIPOLYGON (((566496.6 56... 0.17186172-0.24804621 0.06098647-1.77335609-2.15052250-1.48747349-1.8580879-0.08908721-1.5680132MULTIPOLYGON (((566496.6 56...
508ce1729-2944-4bf4-86f1-0b8c5545ed17 2.6750215-1.22113669-0.4686445-1.5073698 0.4458323 0.6247320 0.7741581-0.2219075-0.4970439MULTIPOLYGON (((548155.2 55...-0.45394071 0.15504147-0.22916032 0.67104277-0.92585359-0.91960294-0.6444084-0.34952125-0.5551767MULTIPOLYGON (((548155.2 55...
60ad9190d-7e7c-4402-b99c-1366ce4f8a4a-1.0122613-0.51202199-0.2827849 0.0466368-0.3198408-0.3913507 0.2796594-0.4558315-0.3996752MULTIPOLYGON (((579895.7 59...-0.26046751-0.25889901-0.77264543-0.48273512-0.22006800-0.35431027-0.4280592-0.60732719-0.6443571MULTIPOLYGON (((579895.7 59...

Export#

# CSV
write.csv(st_drop_geometry(svi_output_cork), file.path(output_dir, "social_vulnerability_index_cork_2022.csv"), row.names = FALSE)

# GeoJSON
st_write(svi_output_cork, file.path(output_dir, "social_vulnerability_index_cork_2022.geojson"), delete_dsn=TRUE)

# Shapefile
st_write(svi_output_cork, file.path(output_dir, "social_vulnerability_index_cork_2022.shp"), append = FALSE)
Deleting source `../../3_outputs/Ireland/2022/Cork/social_vulnerability_index_cork_2022.geojson' using driver `GeoJSON'
Writing layer `social_vulnerability_index_cork_2022' to data source 
  `../../3_outputs/Ireland/2022/Cork/social_vulnerability_index_cork_2022.geojson' using driver `GeoJSON'
Writing 2206 features with 46 fields and geometry type Multi Polygon.
Warning message in abbreviate_shapefile_names(obj):
“Field names abbreviated for ESRI Shapefile driver”
Deleting layer `social_vulnerability_index_cork_2022' using driver `ESRI Shapefile'
Writing layer `social_vulnerability_index_cork_2022' to data source 
  `../../3_outputs/Ireland/2022/Cork/social_vulnerability_index_cork_2022.shp' using driver `ESRI Shapefile'
Writing 2206 features with 46 fields and geometry type Multi Polygon.

END