View source: R/statswales_get_dataset.R
| statswales_get_dataset | R Documentation |
Returns a data frame containing rows from a published dataset. Filters and display options are submitted to the API as a stored query; the same inputs always produce the same query ID so repeated calls are efficient.
statswales_get_dataset(
dataset_id,
lang = "en-gb",
page_number = 1,
page_size = 10000,
filter = NULL,
options = list(use_raw_column_names = FALSE, use_reference_values = FALSE,
data_value_type = "formatted"),
sort_by = NULL,
all_pages = TRUE,
tidy = TRUE
)
dataset_id |
A dataset UUID string. Use |
lang |
Language for text values. One of |
page_number |
Page of results to return. Default |
page_size |
Rows per page. Default |
filter |
A list of filter objects. Each element is a named list mapping
a column name (from |
options |
A named list of display options:
Note: as of July 2026 the StatsWales API ignores |
sort_by |
Optional sort order. Either a ready-made string in the API's
|
all_pages |
If |
tidy |
If |
A data frame of dataset rows, or NULL if the request fails.
## Not run:
datasets <- statswales_list_datasets()
id <- datasets$id[1]
# Entire dataset, human-readable (default)
df <- statswales_get_dataset(id)
# A single page of 100 rows
df_page <- statswales_get_dataset(id, all_pages = FALSE, page_size = 100)
# Filtered to specific years
filters <- statswales_get_filters(id)
df_filtered <- statswales_get_dataset(
id,
filter = list(list(Year = c("2020", "2021")))
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.