-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from humaniverse/simd-underlying-indicators
Added underlying indicators for SIMD 2012
- Loading branch information
Showing
10 changed files
with
20,665 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
library(tidyverse) | ||
library(devtools) | ||
library(compositr) | ||
library(readxl) | ||
|
||
# Load package | ||
load_all(".") | ||
|
||
# ---- Income ---- | ||
query_url <- | ||
query_urls |> | ||
filter(data_set == "imd2012_dz01_scotland_indicators_income") |> | ||
pull(query_url) | ||
|
||
tf <- download_file(query_url, ".xls") | ||
|
||
income <- read_excel(tf) | ||
|
||
income <- | ||
income |> | ||
rename(dz01_code = `Data Zone`) |> | ||
select(-`Local Authority Code`, -`...7`, -Notes) | ||
|
||
# ---- Employment ---- | ||
query_url <- | ||
query_urls |> | ||
filter(data_set == "imd2012_dz01_scotland_indicators_employment") |> | ||
pull(query_url) | ||
|
||
tf <- download_file(query_url, ".xls") | ||
|
||
employment <- read_excel(tf) | ||
|
||
employment <- | ||
employment |> | ||
rename(dz01_code = `Data Zone`) |> | ||
select(-`Local Authority Code`, -`...7`, -Notes) | ||
|
||
# ---- Health ---- | ||
query_url <- | ||
query_urls |> | ||
filter(data_set == "imd2012_dz01_scotland_indicators_health") |> | ||
pull(query_url) | ||
|
||
tf <- download_file(query_url, ".xls") | ||
|
||
health <- read_excel(tf) | ||
|
||
health <- | ||
health |> | ||
rename(dz01_code = `Data Zone`) |> | ||
select(-`Local Authority Code`, -`...12`, -Notes) | ||
|
||
# ---- Education ---- | ||
query_url <- | ||
query_urls |> | ||
filter(data_set == "imd2012_dz01_scotland_indicators_education") |> | ||
pull(query_url) | ||
|
||
tf <- download_file(query_url, ".xls") | ||
|
||
education <- read_excel(tf) | ||
|
||
education <- | ||
education |> | ||
rename(dz01_code = `Data Zone`) |> | ||
select(-`Local Authority Code`, -`...10`, -Notes) | ||
|
||
# ---- Housing ---- | ||
query_url <- | ||
query_urls |> | ||
filter(data_set == "imd2012_dz01_scotland_indicators_housing") |> | ||
pull(query_url) | ||
|
||
tf <- download_file(query_url, ".xls") | ||
|
||
housing <- read_excel(tf) | ||
|
||
housing <- | ||
housing |> | ||
rename(dz01_code = `Data Zone`) |> | ||
select(-`Local Authority Code`, -`...8`, -Notes) | ||
|
||
# ---- Access ---- | ||
query_url <- | ||
query_urls |> | ||
filter(data_set == "imd2012_dz01_scotland_indicators_access") |> | ||
pull(query_url) | ||
|
||
tf <- download_file(query_url, ".xls") | ||
|
||
access <- read_excel(tf) | ||
|
||
access <- | ||
access |> | ||
rename(dz01_code = `Data Zone`) |> | ||
select(-`Local Authority Code`, -`...16`, -Notes) | ||
|
||
# ---- Crime ---- | ||
query_url <- | ||
query_urls |> | ||
filter(data_set == "imd2012_dz01_scotland_indicators_crime") |> | ||
pull(query_url) | ||
|
||
tf <- download_file(query_url, ".xls") | ||
|
||
crime <- read_excel(tf) | ||
|
||
crime <- | ||
crime |> | ||
rename(dz01_code = `Data Zone`) |> | ||
select(-`Local Authority Code`, -`...7`, -Notes) | ||
|
||
# ---- Combine indicators ---- | ||
imd2012_dz01_scotland_indicators <- | ||
income |> | ||
left_join(employment) |> | ||
left_join(health) |> | ||
left_join(education) |> | ||
left_join(housing) |> | ||
left_join(access) |> | ||
left_join(crime) | ||
|
||
# Save output to data/ folder | ||
usethis::use_data(imd2012_dz01_scotland_indicators, overwrite = TRUE) | ||
readr::write_csv(imd2012_dz01_scotland_indicators, "data-raw/imd2012_dz01_scotland_indicators.csv") |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
library(tidyverse) | ||
library(devtools) | ||
library(compositr) | ||
library(readxl) | ||
|
||
# Load package | ||
load_all(".") | ||
|
||
# Set query url | ||
query_url <- | ||
query_urls |> | ||
filter(data_set == "imd2016_dz11_scotland_indicators") |> | ||
pull(query_url) | ||
|
||
tf <- download_file(query_url, ".xlsx") | ||
|
||
imd2016_dz11_scotland_indicators <- read_excel(tf, sheet = "Data") | ||
|
||
imd2016_dz11_scotland_indicators <- | ||
imd2016_dz11_scotland_indicators |> | ||
rename(dz11_code = Data_Zone) |> | ||
select(-Intermediate_Zone, -Council_area) | ||
|
||
# Save output to data/ folder | ||
usethis::use_data(imd2016_dz11_scotland_indicators, overwrite = TRUE) | ||
readr::write_csv(imd2016_dz11_scotland_indicators, "data-raw/imd2016_dz11_scotland_indicators.csv") |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
library(tidyverse) | ||
library(devtools) | ||
library(compositr) | ||
library(readxl) | ||
|
||
# Load package | ||
load_all(".") | ||
|
||
# Set query url | ||
query_url <- | ||
query_urls |> | ||
filter(data_set == "imd2020_dz11_scotland_indicators") |> | ||
pull(query_url) | ||
|
||
tf <- download_file(query_url, ".xlsx") | ||
|
||
imd2020_dz11_scotland_indicators <- read_excel(tf, sheet = "Data") | ||
|
||
imd2020_dz11_scotland_indicators <- | ||
imd2020_dz11_scotland_indicators |> | ||
rename(dz11_code = Data_Zone) |> | ||
select(-Intermediate_Zone, -Council_area) | ||
|
||
# Save output to data/ folder | ||
usethis::use_data(imd2020_dz11_scotland_indicators, overwrite = TRUE) | ||
readr::write_csv(imd2020_dz11_scotland_indicators, "data-raw/imd2020_dz11_scotland_indicators.csv") |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.