Package 'dkstat'

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

Help Index


This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk)

Description

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.

Usage

dst_get_all_data(table, lang = "da", parse_dst_tid = TRUE)

Arguments

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".

Author(s)

Aleksander Bang-Larsen [email protected]

See Also

Other Data retrival functions: dst_get_data()


This function returns the requested data from the StatBank table. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk)

Description

Get data from a table in the StatBank.

Usage

dst_get_data(
  table,
  ...,
  query = NULL,
  parse_dst_tid = TRUE,
  lang = "da",
  meta_data = NULL,
  format = "CSV",
  value_presentation = "Value"
)

Arguments

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.

See Also

Other Data retrival functions: dst_get_all_data()


This functions downloads all the available tables.

Description

This functions downloads all the available tables.

Usage

dst_get_tables(lang = "da")

Arguments

lang

"da" (danish) or "en" (english)


This function returns meta data for a table from StatBank Denmark / Statistics Denmark. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk)

Description

This function POSTs a request for meta data on a table from Statistics Denmark and returns a JSON object with the information.

Usage

dst_meta(table, ..., lang = "da")

Arguments

table

The name of the table you want meta data for.

...

Ignored.

lang

You can choose "en" for english or "da" for danish.


Cached list of all available tables

Description

Cached list of all available tables

Usage

tables

Format

tables

A data frame with 2339 rows and 8 columns:

id

Unique ID of the table

text

Description of the table

unit

The unit of the values represented in the table

updated

When this table was last updated

firstPeriod

The time of the first observation in the table

latestPeriod

The time of the latest observation in the table

active

Binary indicator of the table being active

variables

List of the variables in the table