Description Usage Arguments Value Examples
View source: R/retrieve_functions.R
The function retrieves a specific table from Statistics Denmark based on a table ID and some parameters to the API.
1 2 | sdk_retrieve_data(table_id, ..., lang = "en",
base_url = "http://api.statbank.dk/v1/")
|
table_id |
is the id of the table you want to call. You can get table ids by calling the sdk_retrieve_tables function. |
... |
are parameters you need to use to specify what data you want from the API. See the data created by the sdk_retrieve_metadata function. An * indicates ALL settings in the given parameter. |
lang |
whether to return the data in english or danish. |
base_url |
is the base url for the API you wish to call. Statistics Denmark can sometimes create custom API's that you can use by changing this parameter. |
a data frame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | metadata <- statsDK::sdk_retrieve_metadata("FOLK1A")
dplyr::glimpse(metadata)
# See the variables as a data frame
variables <- statsDK::sdk_get_variables(metadata)
dplyr::glimpse(variables)
# Use the param and the settings columns from the variables data to set the
# rigth values for the API call.
df_en <- statsDK::sdk_retrieve_data("PRIS111", VAREGR = "000000", ENHED = "*",
Tid = paste(paste0("2017M0", 1:8), collapse = ","))
dplyr::glimpse(df_en)
df_da <- statsDK::sdk_retrieve_data("PRIS111", VAREGR = "000000", ENHED = "*",
Tid = paste(paste0("2017M0", 1:8), collapse = ","),
lang = "da")
dplyr::glimpse(df_da)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.