Skip to content

Commit

Permalink
re-run run_all.R
Browse files Browse the repository at this point in the history
comment out aus_skills until url has been fixed
  • Loading branch information
peteowen1 committed Aug 22, 2023
1 parent 7d4eb82 commit 671dccd
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 59 deletions.
Binary file modified R/sysdata.rda
Binary file not shown.
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/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 671dccd

Please sign in to comment.