Skip to content

Commit

Permalink
Merge pull request #106 from peteowen1/aus-holiday
Browse files Browse the repository at this point in the history
Aus holiday
  • Loading branch information
MattCowgill authored Aug 22, 2023
2 parents 8764d53 + 671dccd commit 5846b40
Show file tree
Hide file tree
Showing 20 changed files with 73 additions and 68 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Depends:
Imports:
dplyr (>= 0.7),
lifecycle,
purrr,
purrr (>= 1.0.0),
readxl,
stringr,
readr,
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion data-raw/create_anzsco2021.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include_factor_variants <- FALSE
to_title <- function(x) str_to_title(x) %>% tools::toTitleCase()

# Set up
anzsco_url <- "https://www.abs.gov.au/statistics/classifications/anzsco-australian-and-new-zealand-standard-classification-occupations/2021/anzsco%202021%20structure.xlsx"
anzsco_url <- "https://www.abs.gov.au/statistics/classifications/anzsco-australian-and-new-zealand-standard-classification-occupations/2021/anzsco%202021%20structure%20v1.2%20062023.xlsx"

temp_dir <- tempdir()
temp_path <- file.path(temp_dir, "anzsco.xlsx")
Expand Down
2 changes: 1 addition & 1 deletion data-raw/create_anzsic_isic_correspondence.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ anzsic_isic_temp <-
rename(anzsic_class_code = 2,
anzsic_class_title = 3,
isic_class_code = 4,
isic_title = 5) %>%
isic_class_title = 5) %>%
select(2:5)

anzsic_isic_temp[anzsic_isic_temp == ""] <- NA
Expand Down
6 changes: 3 additions & 3 deletions data-raw/create_asced_foe2001.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

library(tidyverse)
library(glue)

devtools::load_all()

# include factor variants or nah?
include_factor_variants <- FALSE
Expand All @@ -11,11 +11,11 @@ include_factor_variants <- FALSE
to_title <- function(x) str_to_title(x) %>% tools::toTitleCase()


asced_url <- "https://www.abs.gov.au/AUSSTATS/subscriber.nsf/log?openagent&1272.0%20australian%20standard%20classification%20of%20education%20(asced)%20structures.xls&1272.0&Data%20Cubes&B286FC6C1777688DCA257ECB001657BC&0&2001&29.09.2015&Latest"
asced_url <- "https://www.abs.gov.au/statistics/classifications/australian-standard-classification-education-asced/2001/1272.0%20australian%20standard%20classification%20of%20education%20%28asced%29%20structures.xlsx"


temp_dir <- tempdir()
temp_path <- glue("{temp_dir}/asced_foe.xls")
temp_path <- glue("{temp_dir}/asced_foe.xlsx")

download.file(asced_url, temp_path, mode = "wb")

Expand Down
5 changes: 3 additions & 2 deletions data-raw/create_asced_qual2001.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

library(tidyverse)
library(glue)
devtools::load_all()


# include factor variants or nah?
include_factor_variants <- FALSE

# get url
asced_url <- "https://www.abs.gov.au/AUSSTATS/subscriber.nsf/log?openagent&1272.0%20australian%20standard%20classification%20of%20education%20(asced)%20structures.xls&1272.0&Data%20Cubes&B286FC6C1777688DCA257ECB001657BC&0&2001&29.09.2015&Latest"
asced_url <- "https://www.abs.gov.au/statistics/classifications/australian-standard-classification-education-asced/2001/1272.0%20australian%20standard%20classification%20of%20education%20%28asced%29%20structures.xlsx"


temp_dir <- tempdir()
temp_path <- glue("{temp_dir}/asced_qual.xls")
temp_path <- glue("{temp_dir}/asced_qual.xlsx")

download.file(asced_url, temp_path, mode = "wb")

Expand Down
3 changes: 2 additions & 1 deletion data-raw/create_au_holidays.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ raw_data <- package$resources %>%
x[["url"]]
}) %>%
unlist() %>%
map_dfr(read_csv)
map(read_csv) %>%
list_rbind()

auholidays <- raw_data %>%
transmute(
Expand Down
121 changes: 62 additions & 59 deletions data-raw/create_aus_skills.R
Original file line number Diff line number Diff line change
@@ -1,59 +1,62 @@
# Reading and cleaning the Australian Skills Classification
# see: https://www.nationalskillscommission.gov.au/australian-skills-classification-resources

library(tidyverse)
library(glue)
devtools::load_all()

# include factor variants or nah?
include_factor_variants <- FALSE

# fun for captial -> title case
to_title <- function(x) str_to_title(x) %>% tools::toTitleCase()

# Set up
asc_url <- "https://www.nationalskillscommission.gov.au/sites/default/files/2021-03/Australian%20Skills%20Classification%2012-03-2021.xlsx"

temp_dir <- tempdir()
temp_path <- glue("{temp_dir}/asc.xlsx")

download.file(asc_url, temp_path, mode = "wb")

tidy_acs <- function(.data) {
.data %>%
janitor::clean_names() %>%
rename_with(~ str_replace(.x, "title", "name")) %>%
rename_with(~ str_replace(.x, "_desc$", "_description")) %>%
rename_with(~ str_replace(.x, "tech_tool", "technology_tool")) %>%
mutate(across(contains("anzsco_code"), as.character),
across(contains("ranking"), as.integer),
across(contains("score"), as.integer))
}

# Read and tidy
asc_descriptions <- readxl::read_excel(temp_path, sheet = 2) %>%
tidy_acs()

asc_core_competencies <- readxl::read_excel(temp_path, sheet = 3) %>%
tidy_acs()

asc_core_competencies_descriptions <- readxl::read_excel(temp_path, sheet = 4) %>%
tidy_acs()

asc_specialist_tasks <- readxl::read_excel(temp_path, sheet = 5) %>%
tidy_acs()

asc_technology_tools <- readxl::read_excel(temp_path, sheet = 6) %>%
tidy_acs()

asc_technology_tools_ranking <- readxl::read_excel(temp_path, sheet = 7) %>%
tidy_acs()

# Export
usethis::use_data(asc_descriptions,
asc_core_competencies,
asc_core_competencies_descriptions,
asc_specialist_tasks,
asc_technology_tools,
asc_technology_tools_ranking,
overwrite = TRUE)
# # Comment out until can get links working again
# # Reading and cleaning the Australian Skills Classification
# # see: https://www.nationalskillscommission.gov.au/australian-skills-classification-resources
#
# library(tidyverse)
# library(glue)
# devtools::load_all()
#
# # include factor variants or nah?
# include_factor_variants <- FALSE
#
# # fun for captial -> title case
# to_title <- function(x) str_to_title(x) %>% tools::toTitleCase()
#
# # Set up
# asc_url <- "https://www.nationalskillscommission.gov.au/sites/default/files/2021-03/Australian%20Skills%20Classification%2012-03-2021.xlsx"
# # new_url_page <- 'https://www.nationalskillscommission.gov.au/australian-skills-classification#resources'
# # new_link <- https://www.nationalskillscommission.gov.au/data/ASC/release-2022.09/Australian%20Skills%20Classification%20-%20November%202022.xlsx
#
# temp_dir <- tempdir()
# temp_path <- glue("{temp_dir}/asc.xlsx")
#
# download.file(asc_url, temp_path, mode = "wb")
#
# tidy_acs <- function(.data) {
# .data %>%
# janitor::clean_names() %>%
# rename_with(~ str_replace(.x, "title", "name")) %>%
# rename_with(~ str_replace(.x, "_desc$", "_description")) %>%
# rename_with(~ str_replace(.x, "tech_tool", "technology_tool")) %>%
# mutate(across(contains("anzsco_code"), as.character),
# across(contains("ranking"), as.integer),
# across(contains("score"), as.integer))
# }
#
# # Read and tidy
# asc_descriptions <- readxl::read_excel(temp_path, sheet = 2) %>%
# tidy_acs()
#
# asc_core_competencies <- readxl::read_excel(temp_path, sheet = 3) %>%
# tidy_acs()
#
# asc_core_competencies_descriptions <- readxl::read_excel(temp_path, sheet = 4) %>%
# tidy_acs()
#
# asc_specialist_tasks <- readxl::read_excel(temp_path, sheet = 5) %>%
# tidy_acs()
#
# asc_technology_tools <- readxl::read_excel(temp_path, sheet = 6) %>%
# tidy_acs()
#
# asc_technology_tools_ranking <- readxl::read_excel(temp_path, sheet = 7) %>%
# tidy_acs()
#
# # Export
# usethis::use_data(asc_descriptions,
# asc_core_competencies,
# asc_core_competencies_descriptions,
# asc_specialist_tasks,
# asc_technology_tools,
# asc_technology_tools_ranking,
# overwrite = TRUE)
Binary file modified data/anzsco2009.rda
Binary file not shown.
Binary file modified data/anzsco2013.rda
Binary file not shown.
Binary file modified data/anzsco2019.rda
Binary file not shown.
Binary file modified data/anzsco2021.rda
Binary file not shown.
Binary file modified data/anzsco2022.rda
Binary file not shown.
Binary file modified data/anzsic_isic.rda
Binary file not shown.
Binary file modified data/asced_foe2001.rda
Binary file not shown.
Binary file modified data/asced_qual2001.rda
Binary file not shown.
Binary file modified data/auholidays.rda
Binary file not shown.
Binary file modified data/palette_state_name_2016.rda
Binary file not shown.
Binary file modified data/state_abb_au.rda
Binary file not shown.
Binary file modified data/state_name_au.rda
Binary file not shown.

0 comments on commit 5846b40

Please sign in to comment.