This function downloads the SHARK codes Excel file from SMHI (if not already cached) and reads it into R. The file is stored in a persistent cache directory so it does not need to be downloaded again in subsequent sessions.
Usage
get_shark_codes(
url =
"https://smhi.se/oceanografi/oce_info_data/shark_web/downloads/codelist_SMHI.xlsx",
sheet = 1,
skip = 1,
force = FALSE,
clean_cache_days = 30
)Arguments
- url
Character string with the URL to the SHARK codes Excel file. Defaults to the official SMHI codelist.
- sheet
Sheet to read. Can be either the sheet name or its index (default is
1).- skip
Number of rows to skip before reading data (default is
1, to skip the header row).- force
Logical; if
TRUE, forces re-download of the Excel file even if a cached copy is available. Default isFALSE.- clean_cache_days
Numeric; if not
NULL, cached SHARK code Excel files older than this number of days will be automatically deleted. Defaults to 30. Set toNULLto disable automatic cleanup.
See also
clean_shark4r_cache() to manually clear cached files.
