Title: | API connection to the StatBank from Statistics Denmark |
---|---|
Description: | This package provides a few simple functions that can be used to query the StatBank from Statistics Denmark. |
Authors: | Aleksander Bang-Larsen [aut, cre] , Kenneth Rose [aut] (Original creator), Thomas J. leeper [ctb] |
Maintainer: | Aleksander Bang-Larsen <[email protected]> |
License: | GPL-2 |
Version: | 0.0.0.9001 |
Built: | 2024-12-10 17:20:43 UTC |
Source: | https://github.com/rOpenGov/dkstat |
Get all data from a table in the StatBank. This function
provides all the query parameters on the user's behalf. You, as a user, do
not need to specify anything other than a table name and you will be given
the entire contents of the table in a nice long format. This is useful for
you, if you would like to filter the table with e.g. {dplyr}
functions or
save the entire table for archival.
dst_get_all_data(table, lang = "da", parse_dst_tid = TRUE)
dst_get_all_data(table, lang = "da", parse_dst_tid = TRUE)
table |
Table from StatBank. |
lang |
language. "en" for english or "da" for danish. |
parse_dst_tid |
Logical. Default is TRUE. The date will be the first day of the period and the time zone is "UTC" and not the Danish "CET". |
Aleksander Bang-Larsen [email protected]
Other Data retrival functions:
dst_get_data()
Get data from a table in the StatBank.
dst_get_data( table, ..., query = NULL, parse_dst_tid = TRUE, lang = "da", meta_data = NULL, format = "CSV", value_presentation = "Value" )
dst_get_data( table, ..., query = NULL, parse_dst_tid = TRUE, lang = "da", meta_data = NULL, format = "CSV", value_presentation = "Value" )
table |
Table from StatBank. |
... |
Build your own query. |
query |
A list object with your query. |
parse_dst_tid |
Logical. Default is TRUE. The date will be the first day of the period and the time zone is "UTC" and not the Danish "CET". |
lang |
language. "en" for english or "da" for danish. |
meta_data |
Meta data for the table. If NULL the meta data will be requested. |
format |
character value. "CSV" or "BULK". If you choose BULK then you need to select a value for each of the parameters. |
value_presentation |
For now, "value" or "default". When a table with observations that have the same name, this is automatically changed to CodeAndValue. |
Other Data retrival functions:
dst_get_all_data()
This functions downloads all the available tables.
dst_get_tables(lang = "da")
dst_get_tables(lang = "da")
lang |
"da" (danish) or "en" (english) |
This function POSTs a request for meta data on a table from Statistics Denmark and returns a JSON object with the information.
dst_meta(table, ..., lang = "da")
dst_meta(table, ..., lang = "da")
table |
The name of the table you want meta data for. |
... |
Ignored. |
lang |
You can choose "en" for english or "da" for danish. |
This function provides a search function for the description field of available data series
dst_search(string = "gpd", field = "text", lang = "da", use_cache = NULL)
dst_search(string = "gpd", field = "text", lang = "da", use_cache = NULL)
string |
Character string. Speficies the search term. |
field |
Character string. |
lang |
Character. "da" for danish or "en" for english. |
use_cache |
A logical scalar. Should the function call Statbank or use a (possibly outdated) saved version of their tables? |
Cached list of all available tables
tables
tables
tables
A data frame with 2339 rows and 8 columns:
Unique ID of the table
Description of the table
The unit of the values represented in the table
When this table was last updated
The time of the first observation in the table
The time of the latest observation in the table
Binary indicator of the table being active
List of the variables in the table