Skip to contents

Downloads one or more datasets (zip-archives) from the SHARK database (Swedish national marine environmental data archive) and optionally unzips them. The function matches provided dataset names against all available SHARK datasets.

Usage

get_shark_datasets(
  dataset_name,
  save_dir = "",
  prod = TRUE,
  unzip_file = FALSE,
  verbose = TRUE
)

Arguments

dataset_name

Character vector with one or more dataset names (or partial names). Each entry will be matched against available SHARK dataset identifiers (e.g., "SHARK_Phytoplankton_2023_SMHI_BVVF" for a specific dataset, or "SHARK_Phytoplankton" for all Phytoplankton datasets).

save_dir

Directory where zip files (and optionally their extracted contents) should be stored. Defaults to "". If NULL or "", the current working directory is used.

prod

Logical, whether to download from the production (TRUE, default) or test (FALSE) SHARK server.

unzip_file

Logical, whether to extract downloaded zip archives (TRUE) or only save them (FALSE, default).

verbose

Logical, whether to show download and extraction progress messages. Default is TRUE.

Value

A named list of character vectors. Each element corresponds to one matched dataset and contains either the path to the downloaded zip file (if unzip_file = FALSE) or the path to the extraction directory (if unzip_file = TRUE).

See also

https://shark.smhi.se for SHARK database.

get_shark_options() for listing available datasets.

get_shark_data() for listing available datasets.

Examples

if (FALSE) { # \dontrun{
# Download one dataset to a temporary folder
get_shark_datasets("SHARK_Phytoplankton_2023_SMHI_BVVF")

# Download multiple datasets and unzip them into the data directory
get_shark_datasets(
  dataset_name = c("Phytoplankton_2023", "Zooplankton_2022"),
  save_dir = "data",
  unzip_file = TRUE
)
} # }