View source: R/statswales_download_dataset.R
| statswales_download_dataset | R Documentation |
Downloads a published dataset as a file. The filter and options
arguments work identically to statswales_get_dataset().
statswales_download_dataset(
dataset_id,
format = "csv",
lang = "en-gb",
path = NULL,
filter = NULL,
options = list(use_raw_column_names = FALSE, use_reference_values = FALSE,
data_value_type = "formatted")
)
dataset_id |
A dataset UUID string. Use |
format |
File format. One of |
lang |
Language for the downloaded file. One of |
path |
File path for saving the download. If |
filter |
Filter criteria in the same format as |
options |
Display options in the same format as |
The path to the downloaded file, invisibly. Returns NULL if the
download fails.
## Not run:
datasets <- statswales_list_datasets()
id <- datasets$id[1]
# Download full dataset as CSV
path <- statswales_download_dataset(id)
df <- read.csv(path)
# Download filtered data as Excel
statswales_download_dataset(
id,
format = "xlsx",
filter = list(list(Year = c("2022", "2023"))),
path = "my_data.xlsx"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.