Code
## define variables
url = "https://wid.world/wp-content/uploads/2019/05/WID_SummaryTable_24May2019.xlsx"
chapter_folder = "chap81"
file_name = "summary_table.xlsx"
## create folder for chapter if not already done
chap_folder <-
base::paste0(
here::here(),
paste0("/data/", chapter_folder, "/")
)
if (!base::file.exists(chap_folder))
{base::dir.create(chap_folder)}
## get summary table
destfile <- base::paste0(chap_folder, file_name)
utils::download.file(url, destfile)
summary_table <- readxl::read_xlsx(destfile)
## save cleaned data
pb_save_data_file("chap81", summary_table, "summary_table.rds")