download_classification_standards.RdDownloads the latest versions of classification standard Excel files from the Italian Ministry of Labor and Social Policies website. These files contain official classifications used in administrative data systems (URP).
download_classification_standards(
output_dir = "data-raw/classifications",
url = NULL,
download_all = FALSE,
force_refresh = FALSE,
use_js_scraping = FALSE,
classification_types = NULL,
verbose = TRUE
)Character. Directory where files will be saved. Defaults to "data-raw/classifications". Created if it doesn't exist.
Character. URL of the classifications page. Defaults to the official Italian Labor Ministry classification standards page if NULL.
Logical. If TRUE, download all versions found. If FALSE (default), download only the latest version of each classification type.
Logical. If TRUE, re-download files even if they already exist. Default is FALSE.
Logical. If TRUE, use JavaScript-enabled scraping. Default is FALSE. Currently not implemented.
Character vector. Types to download. NULL (default) downloads all types. Available types include: "classificazioni_standard", "allegato", "migrazione".
Logical. Print progress messages. Default is TRUE.
Invisibly returns a data.table with information about downloaded files:
Downloaded filename
Source URL
Original link text from webpage
Extracted version number (NA if not parseable)
Classification type
Full path to downloaded file
Timestamp when file was downloaded
File size in bytes
A metadata file is also saved to output_dir/download_metadata.rds
containing download information and file list.
The function can:
Scrape the classifications page to find available files
Parse version numbers from filenames
Download only the latest version of each classification type
Skip already-downloaded files (unless force_refresh = TRUE)
Save metadata about downloaded files
The main classification types are:
Main classification standards file (Rev.XXX-ST-Classificazioni-Standard.xlsx). Contains multiple sheets with various classification codes used in Italian administrative systems.
Annexes with additional information or mappings
Migration analysis files showing changes between classification versions
This function requires the rvest and polite packages for
web scraping. Install them with:
install.packages(c("rvest", "polite"))
The Labor Ministry website may change structure over time. If scraping fails, you may need to download files manually from: https://urponline.lavoro.gov.it/s/standard-tecnici/classificazioni-standard
if (FALSE) { # \dontrun{
# Download latest versions only (recommended)
files <- download_classification_standards()
# Download to specific directory
files <- download_classification_standards(
output_dir = "my_data/classifications"
)
# Force re-download of all files
files <- download_classification_standards(force_refresh = TRUE)
# Download only main classification standards
files <- download_classification_standards(
classification_types = "classificazioni_standard"
)
# Download all versions (not just latest)
files <- download_classification_standards(download_all = TRUE)
# View downloaded files
print(files)
# Check what was downloaded
files[, .(filename, version, type, file_size)]
} # }