Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ap semp occ jul jun2022 #80

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed Data/3_APSempOcc/nomis_2022_06_14_092401.xlsx
Binary file not shown.
Binary file added Data/3_APSempOcc/nomis_2022_10_13_205752.xlsx
Binary file not shown.
Binary file modified Data/4_APSempRate/nomis_2022_10_12_114302.xlsx
Binary file not shown.
79 changes: 79 additions & 0 deletions Data/AppData/C_EmpOcc_APS22.csv

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Data/AppData/C_EmpRate_APS1822.csv
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@
"2022","Greater Lincolnshire","LEP",657600,503000,488000,433800,53700,15000,154500,0.742092457420925,22
"2022","Hull and East Yorkshire","LEP",359800,281500,270300,240500,28100,11200,78300,0.751250694830461,22
"2022","Leeds City Region","LEP",1452400,1118700,1071500,946800,123800,47300,333700,0.73774442302396,22
"2022","//www.ons.gov.uk/news/statementsandletters/occupationaldatainonssurveys.","AN ISSUE WITH THE COLLECTION OF OCCUPATIONAL DATA AFFECTED THE ACCURACY OF THE BREAKDOWNS OF SOME DETAILED OCCUPATIONS, AND DATA DERIVED FROM THEM. WE ARE URGING CAUTION IN THE INTERPRETATION OF THESE DETAILED DATA AS WE RESOLVE THE ISSUE. HTTPS",NA,NA,NA,NA,NA,NA,NA,NA,22
"2018","Brighton and Hove, East Sussex, West Sussex","LSIP",1019300,803900,777900,631800,144600,20500,215600,0.763170803492593,18
"2018","Buckinghamshire ","LSIP",320600,264300,259500,211000,47300,4800,56300,0.809419837804117,18
"2018","Cambridgeshire and Peterborough","LSIP",525400,425900,413800,361400,52400,11100,99500,0.787590407308717,18
Expand Down
1 change: 0 additions & 1 deletion Data/AppData/C_EmpRate_APS1822_max_min.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"area","minEmp","maxEmp"
"//www.ons.gov.uk/news/statementsandletters/occupationaldatainonssurveys.",NA,NA
"Black Country",491700,536500
"Brighton and Hove, East Sussex, West Sussex",777900,815600
"Buckinghamshire",251700,264500
Expand Down
442 changes: 442 additions & 0 deletions Data/AppData/D_EmpOcc_APS22.csv

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Data/AppData/D_EmpRate_APS1822.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,6 @@
"2022","Greater Lincolnshire","LEP","657600","503000","488000","433800","53700","15000","154500"
"2022","Hull and East Yorkshire","LEP","359800","281500","270300","240500","28100","11200","78300"
"2022","Leeds City Region","LEP","1452400","1118700","1071500","946800","123800","47300","333700"
"2022","//www.ons.gov.uk/news/statementsandletters/occupationaldatainonssurveys.","AN ISSUE WITH THE COLLECTION OF OCCUPATIONAL DATA AFFECTED THE ACCURACY OF THE BREAKDOWNS OF SOME DETAILED OCCUPATIONS, AND DATA DERIVED FROM THEM. WE ARE URGING CAUTION IN THE INTERPRETATION OF THESE DETAILED DATA AS WE RESOLVE THE ISSUE. HTTPS",NA,NA,NA,NA,NA,NA,NA
"2018","Brighton and Hove, East Sussex, West Sussex","LSIP","1019300","803900","777900","631800","144600","20500","215600"
"2018","Buckinghamshire ","LSIP","320600","264300","259500","211000","47300","4800","56300"
"2018","Cambridgeshire and Peterborough","LSIP","525400","425900","413800","361400","52400","11100","99500"
Expand Down
2 changes: 1 addition & 1 deletion ExtractLoadData.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ I_missingLAD <- read.xlsx(xlsxFile = paste0("./Data/", folder, "/", list.files(p
# Cell: T09a Employment by occupation (SOC2010) sub-major group and full-time/part-time; All people/ All people
folder <- "3_APSempOcc"
sheetNum <- 1
I_EmpOcc_APS1721 <- read.xlsx(xlsxFile = paste0("./Data/", folder, "/", list.files(path = paste0("./Data/", folder))), sheet = sheetNum, skipEmptyRows = T)
I_EmpOcc_APS22 <- read.xlsx(xlsxFile = paste0("./Data/", folder, "/", list.files(path = paste0("./Data/", folder))), sheet = sheetNum, skipEmptyRows = T)


### Employment level and rate ------------
Expand Down
4 changes: 2 additions & 2 deletions R/Loading Core Indicators.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ C_LEP2020 <- read.csv(file = "./Data/AppData/C_LEP2020.csv", check.names = FALSE

## Employment by occupation ----
# data for download
D_EmpOcc_APS1721 <- read.csv(file = "./Data/AppData/D_EmpOcc_APS1721.csv", check.names = FALSE)
D_EmpOcc_APS22 <- read.csv(file = "./Data/AppData/D_EmpOcc_APS22.csv", check.names = FALSE)
# data for dashboard
C_EmpOcc_APS1721 <- read.csv(file = "./Data/AppData/C_EmpOcc_APS1721.csv", check.names = FALSE)
C_EmpOcc_APS22 <- read.csv(file = "./Data/AppData/C_EmpOcc_APS22.csv", check.names = FALSE)

## Employment level and rate ----
# data for download
Expand Down
2 changes: 1 addition & 1 deletion R/panels.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ panel_employment <- function() {
### Employment percentage by occupation data table ----
column(
width = 6,
h2("Employment share by occupation: Jan-Dec 2021"),
h2("Employment share by occupation: Jul-Jun 2022"),
dataTableOutput("EmpOcc"),
details(
label = "Source: Annual Population Survey",
Expand Down
24 changes: 12 additions & 12 deletions TransformData.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ format.EmpOcc.APS <- function(x) {
mutate(check = ifelse(grepl(":", area), 1, 0)) %>% # remove anything but LEP and Country
filter(check == 1) %>%
filter(!grepl("nomisweb", area)) %>%
select(year = jan_2017_dec_2017, area, everything(), -check) %>% # reorder and remove
mutate(year = 2022) %>%
select(year, area, everything(), -check, -jul_2021_jun_2022) %>% # reorder and remove
mutate(geographic_level = gsub(":.*", "", area)) %>% # Get geog type
mutate(area = gsub(".*:", "", area)) %>% # Tidy up Area names
mutate(area = case_when(
Expand All @@ -60,10 +61,9 @@ format.EmpOcc.APS <- function(x) {
TRUE ~ area
)) %>% # Rename so matches official name
relocate(geographic_level, .after = area) %>%
mutate(year = as.numeric(substr(year, 5, 8))) %>%
rename_with(
.fn = ~ str_replace_all(.x, c("t09a_" = "", "all_people" = "", "soc2010" = "", "_" = " ")),
.cols = starts_with("t09a_")
.fn = ~ str_replace_all(.x, c("t09b_" = "", "all_people" = "", "soc2020" = "", "_" = " ")),
.cols = starts_with("t09b_")
) %>%
rename_with(~ gsub("[[:digit:]]+", "", .)) %>% # remove numbers from occupations since they don't match the ONS ones
mutate(geographic_level = toupper(geographic_level))
Expand All @@ -78,31 +78,31 @@ format.EmpOcc.APS <- function(x) {
rename(area = LSIP) %>%
relocate(area, .before = geographic_level) %>%
mutate_at(vars(-year, -area, -geographic_level), function(x) str_replace_all(x, c("!" = "", "\\*" = "", "~" = "", "-" = ""))) %>% # convert to blank to avoid error msg
mutate_at(c(4:28), as.numeric) %>% # Convert to numeric
mutate_at(c(4:29), as.numeric) %>% # Convert to numeric
group_by(year, area, geographic_level) %>% # sum for each LSIP
summarise(across(everything(), list(sum), na.rm = T)) %>%
rename_with(~ gsub("_1", "", .)) %>% # remove numbers cretaed by the summarise function
mutate_at(c(4:28), as.character) # Convert to sring to bind
mutate_at(c(4:29), as.character) # Convert to sring to bind

# join together
bind_rows(reformat, addlsip)
}
# format data
F_EmpOcc_APS1721 <- format.EmpOcc.APS(I_EmpOcc_APS1721)
F_EmpOcc_APS22 <- format.EmpOcc.APS(I_EmpOcc_APS22)
# create downloadable version with new suppression rules
D_EmpOcc_APS1721 <- F_EmpOcc_APS1721 %>%
D_EmpOcc_APS22 <- F_EmpOcc_APS22 %>%
mutate_at(vars(-year, -area, -geographic_level), function(x) str_replace_all(x, c("!" = "c", "\\*" = "u", "~" = "low", "-" = "x")))
write.csv(D_EmpOcc_APS1721, file = "Data\\AppData\\D_EmpOcc_APS1721.csv", row.names = FALSE)
write.csv(D_EmpOcc_APS22, file = "Data\\AppData\\D_EmpOcc_APS22.csv", row.names = FALSE)
# create version to use in dashboard
C_EmpOcc_APS1721 <- F_EmpOcc_APS1721 %>%
C_EmpOcc_APS22 <- F_EmpOcc_APS22 %>%
mutate_at(vars(-year, -area, -geographic_level), function(x) str_replace_all(x, c("!" = "", "\\*" = "", "~" = "", "-" = ""))) %>% # convert to blank to avoid error msg
mutate_at(c(4:28), as.numeric) %>% # Convert to numeric
filter(
year == "2021",
year == "2022",
geographic_level != "LADU" &
geographic_level != "GOR" # cleans up for London and South East which is included as lep and gor
)
write.csv(C_EmpOcc_APS1721, file = "Data\\AppData\\C_EmpOcc_APS1721.csv", row.names = FALSE)
write.csv(C_EmpOcc_APS22, file = "Data\\AppData\\C_EmpOcc_APS22.csv", row.names = FALSE)

## Employment level and rate ----
format.EmpRate.APS <- function(x) {
Expand Down
12 changes: 6 additions & 6 deletions server.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ server <- function(input, output, session) {
},
content = function(file) {
write_xlsx(list(
"1a.Emp by occupation" = D_EmpOcc_APS1721
"1a.Emp by occupation" = D_EmpOcc_APS22
), path = file)
}
)
Expand Down Expand Up @@ -145,7 +145,7 @@ server <- function(input, output, session) {
### Downloads----
# download all indicators
list_of_datasets0 <- list(
"1a.Emp by occupation" = D_EmpOcc_APS1721,
"1a.Emp by occupation" = D_EmpOcc_APS22,
"1b.Emp rate" = D_EmpRate_APS1822,
"2.Vacancies" = C_Vacancy_ONS1722,
"3a.FE achievements SSA" = D_Achieve_ILR21,
Expand All @@ -163,7 +163,7 @@ server <- function(input, output, session) {
# Download current LEP indicators
filtered_data0 <- reactive({
list(
"1a.Emp by occupation" = filter(D_EmpOcc_APS1721, geographic_level == input$GeoType, area == input$lep1),
"1a.Emp by occupation" = filter(D_EmpOcc_APS22, geographic_level == input$GeoType, area == input$lep1),
"1b.Emp rate" = filter(D_EmpRate_APS1822, geographic_level == input$GeoType, area == input$lep1),
"2.Vacancies" = filter(C_Vacancy_ONS1722, geographic_level == input$GeoType, area == input$lep1),
"3a.FE achievements SSA" = filter(D_Achieve_ILR21, geographic_level == input$GeoType, area == input$lep1),
Expand Down Expand Up @@ -693,7 +693,7 @@ server <- function(input, output, session) {

### Downloads----
list_of_datasets1 <- list(
"1a.Emp by occupation" = D_EmpOcc_APS1721,
"1a.Emp by occupation" = D_EmpOcc_APS22,
"1b.Emp rate" = D_EmpRate_APS1822
)
output$download_btn1a <- downloadHandler(
Expand All @@ -708,7 +708,7 @@ server <- function(input, output, session) {
# Download current LEP indicators
filtered_data1 <- reactive({
list(
"1a.Emp by occupation" = filter(D_EmpOcc_APS1721, geographic_level == input$GeoType, area == input$lep1),
"1a.Emp by occupation" = filter(D_EmpOcc_APS22, geographic_level == input$GeoType, area == input$lep1),
"1b.Emp rate" = filter(D_EmpRate_APS1822, geographic_level == input$GeoType, area == input$lep1)
)
})
Expand Down Expand Up @@ -850,7 +850,7 @@ server <- function(input, output, session) {

## Employment by occupation data table ----
EmpOcc <- eventReactive(c(input$lep1, input$lep2), {
EmpOcc <- C_EmpOcc_APS1721 %>%
EmpOcc <- C_EmpOcc_APS22 %>%
filter(
geographic_level == input$GeoType | geographic_level == "COUNTRY",
(area == "England" |
Expand Down