diff --git a/index.html b/index.html index c8d2a29..af179a7 100644 --- a/index.html +++ b/index.html @@ -82,10 +82,19 @@

A short message in Danish

Installation

-

You can only install the development version from github, using Hadley Wickham’s devtools package:

-
if(!require("devtools")) install.packages("devtools")
-library("devtools")
-install_github("rOpenGov/dkstat")
+

You can install dkstat from r-universe with:

+
+install.packages(
+  "dkstat",
+  repos = c(
+    ropengov = "https://ropengov.r-universe.dev",
+    getOption("repos")
+  )
+)
+

You can install the latest development version of dkstat from GitHub with:

+
+# install.packages("devtools")
+devtools::install_github("rOpenGov/dkstat")

Examples @@ -104,7 +113,7 @@

Four basic function
+
 

@@ -113,150 +122,150 @@

The search function
+
 dst_search(string = "bnp", field = "text")
-
##          id
-## 584    NAN1
-## 588    NKN1
-## 593   NAHL2
-## 596   NKHO2
-## 599   NAHO2
-## 602  NAHD21
-## 669    NRHP
-## 670   VNRHP
-## 1318 CFABNP
-##                                                                                   text
-## 584  Forsyningsbalance, bruttonationalprodukt (BNP),økonomisk vækst, beskæftigelse mv.
-## 588                  Forsyningsbalance, Bruttonationalprodukt (BNP), beskæftigelse mv.
-## 593                          1-2.1.1 Produktion, BNP og indkomstdannelse (hovedposter)
-## 596                                        1-2.1.1 Produktion, BNP og indkomstdannelse
-## 599                             1-2.1.1 Produktion, BNP og indkomstdannelse (oversigt)
-## 602                                                   1 Produktion og BNP (detaljeret)
-## 669                                        1-2.1.1 Produktion, BNP og indkomstdannelse
-## 670                           Versionstabel NRHP - Produktion, BNP og indkomstdannelse
-## 1318                                                        FoU udgifter i pct. af BNP
-##             unit             updated firstPeriod latestPeriod active
-## 584            - 2024-10-03T08:00:00        1966         2023   TRUE
-## 588            - 2024-11-20T08:00:00      1990K1       2024K3   TRUE
-## 593     Mio. kr. 2024-06-28T08:00:00        1966         2023   TRUE
-## 596     Mio. kr. 2024-11-20T08:00:00      1990K1       2024K3   TRUE
-## 599     Mio. kr. 2024-06-28T08:00:00        1995         2023   TRUE
-## 602     Mio. kr. 2024-06-28T08:00:00        1995         2023   TRUE
-## 669            - 2024-10-28T08:00:00        1993         2023   TRUE
-## 670            - 2024-10-28T08:00:00        1993         2023   TRUE
-## 1318 Pct. af bnp 2023-12-14T08:00:00        1997         2022   TRUE
-##                                          variables
-## 584                    transaktion, prisenhed, tid
-## 588  transaktion, prisenhed, sæsonkorrigering, tid
-## 593                    transaktion, prisenhed, tid
-## 596  transaktion, prisenhed, sæsonkorrigering, tid
-## 599                    transaktion, prisenhed, tid
-## 602                    transaktion, prisenhed, tid
-## 669            område, transaktion, prisenhed, tid
-## 670   version, område, transaktion, prisenhed, tid
-## 1318                               pct af BNP, tid
+
##          id
+## 584    NAN1
+## 588    NKN1
+## 593   NAHL2
+## 596   NKHO2
+## 599   NAHO2
+## 602  NAHD21
+## 669    NRHP
+## 670   VNRHP
+## 1318 CFABNP
+##                                                                                   text
+## 584  Forsyningsbalance, bruttonationalprodukt (BNP),økonomisk vækst, beskæftigelse mv.
+## 588                  Forsyningsbalance, Bruttonationalprodukt (BNP), beskæftigelse mv.
+## 593                          1-2.1.1 Produktion, BNP og indkomstdannelse (hovedposter)
+## 596                                        1-2.1.1 Produktion, BNP og indkomstdannelse
+## 599                             1-2.1.1 Produktion, BNP og indkomstdannelse (oversigt)
+## 602                                                   1 Produktion og BNP (detaljeret)
+## 669                                        1-2.1.1 Produktion, BNP og indkomstdannelse
+## 670                           Versionstabel NRHP - Produktion, BNP og indkomstdannelse
+## 1318                                                        FoU udgifter i pct. af BNP
+##             unit             updated firstPeriod latestPeriod active
+## 584            - 2024-10-03T08:00:00        1966         2023   TRUE
+## 588            - 2024-11-20T08:00:00      1990K1       2024K3   TRUE
+## 593     Mio. kr. 2024-06-28T08:00:00        1966         2023   TRUE
+## 596     Mio. kr. 2024-11-20T08:00:00      1990K1       2024K3   TRUE
+## 599     Mio. kr. 2024-06-28T08:00:00        1995         2023   TRUE
+## 602     Mio. kr. 2024-06-28T08:00:00        1995         2023   TRUE
+## 669            - 2024-10-28T08:00:00        1993         2023   TRUE
+## 670            - 2024-10-28T08:00:00        1993         2023   TRUE
+## 1318 Pct. af bnp 2023-12-14T08:00:00        1997         2022   TRUE
+##                                          variables
+## 584                    transaktion, prisenhed, tid
+## 588  transaktion, prisenhed, sæsonkorrigering, tid
+## 593                    transaktion, prisenhed, tid
+## 596  transaktion, prisenhed, sæsonkorrigering, tid
+## 599                    transaktion, prisenhed, tid
+## 602                    transaktion, prisenhed, tid
+## 669            område, transaktion, prisenhed, tid
+## 670   version, område, transaktion, prisenhed, tid
+## 1318                               pct af BNP, tid

Download the tables

The dst_get_tables function downloads all the available tables that the search function use when searching for a word or a phrase.

-
+
 head(dst_get_tables(lang = "da"))
-
##         id                            text  unit             updated
-## 1   FOLK1A Befolkningen den 1. i kvartalet Antal 2024-11-11T08:00:00
-## 2  FOLK1AM   Befolkningen den 1. i måneden Antal 2024-11-11T08:00:00
-## 3  BEFOLK1          Befolkningen 1. januar Antal 2024-02-12T08:00:00
-## 4  BEFOLK2          Befolkningen 1. januar Antal 2024-02-12T08:00:00
-## 5    FOLK3          Befolkningen 1. januar Antal 2024-02-12T08:00:00
-## 6 FOLK3FOD          Befolkningen 1. januar Antal 2024-02-12T08:00:00
-##   firstPeriod latestPeriod active                             variables
-## 1      2008K1       2024K4   TRUE       område,køn,alder,civilstand,tid
-## 2     2021M10      2024M10   TRUE                  område,køn,alder,tid
-## 3        1971         2024   TRUE              køn,alder,civilstand,tid
-## 4        1901         2024   TRUE                         køn,alder,tid
-## 5        2008         2024   TRUE fødselsdag,fødselsmåned,fødselsår,tid
-## 6        2008         2024   TRUE  fødselsdag,fødselsmåned,fødeland,tid
+
##         id                            text  unit             updated
+## 1   FOLK1A Befolkningen den 1. i kvartalet Antal 2024-11-11T08:00:00
+## 2  FOLK1AM   Befolkningen den 1. i måneden Antal 2024-11-11T08:00:00
+## 3  BEFOLK1          Befolkningen 1. januar Antal 2024-02-12T08:00:00
+## 4  BEFOLK2          Befolkningen 1. januar Antal 2024-02-12T08:00:00
+## 5    FOLK3          Befolkningen 1. januar Antal 2024-02-12T08:00:00
+## 6 FOLK3FOD          Befolkningen 1. januar Antal 2024-02-12T08:00:00
+##   firstPeriod latestPeriod active                             variables
+## 1      2008K1       2024K4   TRUE       område,køn,alder,civilstand,tid
+## 2     2021M10      2024M10   TRUE                  område,køn,alder,tid
+## 3        1971         2024   TRUE              køn,alder,civilstand,tid
+## 4        1901         2024   TRUE                         køn,alder,tid
+## 5        2008         2024   TRUE fødselsdag,fødselsmåned,fødselsår,tid
+## 6        2008         2024   TRUE  fødselsdag,fødselsmåned,fødeland,tid

Meta data

The dst_meta function retrieves meta data from the table you wan’t to take a closer look at. It can be used to create the final request, but if you can figure out the structure of the query you can define it yourself.

We’ll get some meta data from the AULAAR table. The AULAAR table has net unemployment numbers.

-
+
 aulaar_meta <- dst_meta(table = "AULAAR", lang = "da")

The ‘dst_meta’ function returns a list with 4 objects: - basics - variables - values - basic_query

Basics

Let’s see what the basics contains:

-
+
 aulaar_meta$basics
-
## $id
-## [1] "AULAAR"
-## 
-## $text
-## [1] "Fuldtidsledige (netto)"
-## 
-## $description
-## [1] "Fuldtidsledige (netto) efter køn, personer/pct. og tid"
-## 
-## $unit
-## [1] "Antal"
-## 
-## $updated
-## [1] "2024-04-16T08:00:00"
-## 
-## $footnote
-## NULL
+
## $id
+## [1] "AULAAR"
+## 
+## $text
+## [1] "Fuldtidsledige (netto)"
+## 
+## $description
+## [1] "Fuldtidsledige (netto) efter køn, personer/pct. og tid"
+## 
+## $unit
+## [1] "Antal"
+## 
+## $updated
+## [1] "2024-04-16T08:00:00"
+## 
+## $footnote
+## NULL

There’s a table id, a short description, a unit description and when the table was updated.

Variables

The variables in the list has a short description of each variable as well as the id. You might want to make sure that you have supplied all the ID’s where the elimination columns is equal to FALSE. The IDs where eliminnation is equal FALSE are mandatory.

-
+
 aulaar_meta$variables
-
##       id          text elimination
-## 1    KØN           køn        TRUE
-## 2 PERPCT personer/pct.       FALSE
-## 3    Tid           tid       FALSE
+
##       id          text elimination
+## 1    KØN           køn        TRUE
+## 2 PERPCT personer/pct.       FALSE
+## 3    Tid           tid       FALSE

Values

The values is a list object of all the values in each variable. You use the text column to construct your final query:

-
+
 str(aulaar_meta$values)
-
## List of 3
-##  $ KØN   :'data.frame':  3 obs. of  2 variables:
-##   ..$ id  : chr [1:3] "TOT" "M" "K"
-##   ..$ text: chr [1:3] "I alt" "Mænd" "Kvinder"
-##  $ PERPCT:'data.frame':  2 obs. of  2 variables:
-##   ..$ id  : chr [1:2] "L10" "L9"
-##   ..$ text: chr [1:2] "Procent af arbejdsstyrken" "Ledige (1000 personer)"
-##  $ Tid   :'data.frame':  45 obs. of  2 variables:
-##   ..$ id  : chr [1:45] "1979" "1980" "1981" "1982" ...
-##   ..$ text: chr [1:45] "1979" "1980" "1981" "1982" ...
+
## List of 3
+##  $ KØN   :'data.frame':  3 obs. of  2 variables:
+##   ..$ id  : chr [1:3] "TOT" "M" "K"
+##   ..$ text: chr [1:3] "I alt" "Mænd" "Kvinder"
+##  $ PERPCT:'data.frame':  2 obs. of  2 variables:
+##   ..$ id  : chr [1:2] "L10" "L9"
+##   ..$ text: chr [1:2] "Procent af arbejdsstyrken" "Ledige (1000 personer)"
+##  $ Tid   :'data.frame':  45 obs. of  2 variables:
+##   ..$ id  : chr [1:45] "1979" "1980" "1981" "1982" ...
+##   ..$ text: chr [1:45] "1979" "1980" "1981" "1982" ...

Get data

You need to build your query based on the text column that each variable contains in the meta_data$values list.

-
+
 aulaar <- dst_get_data(
   table = "AULAAR", KØN = "Total", PERPCT = "Per cent of the labour force", Tid = 2013,
   lang = "en"
 )
 str(aulaar)
-
## 'data.frame':    1 obs. of  4 variables:
-##  $ KØN   : chr "Total"
-##  $ PERPCT: chr "Per cent of the labour force"
-##  $ TID   : POSIXct, format: "2013-01-01"
-##  $ value : num 4.4
+
## 'data.frame':    1 obs. of  4 variables:
+##  $ KØN   : chr "Total"
+##  $ PERPCT: chr "Per cent of the labour force"
+##  $ TID   : POSIXct, format: "2013-01-01"
+##  $ value : num 4.4

In the request above I don’t supply the meta_data to the dst_get_data function, but this is possible as I will show below. It’s a good idea to supply the meta data to the dst_get_data function if you query the table more than once. If you don’t supply the meta data the dst_get_data function will request the meta data for the table and this will be very ineffecient.

Let’s query the statbank using more than one value for each variable.

-
+
 folk1a_meta <- dst_meta("folk1a", lang = "da")
 
 str(dst_get_data(
@@ -268,15 +277,15 @@ 

Get data lang = "da", meta_data = folk1a_meta ))

-
## 'data.frame':    172720 obs. of  5 variables:
-##  $ TID       : POSIXct, format: "2008-01-01" "2008-01-01" ...
-##  $ CIVILSTAND: chr  "I alt" "I alt" "I alt" "I alt" ...
-##  $ ALDER     : chr  "Alder i alt" "Alder i alt" "Alder i alt" "Alder i alt" ...
-##  $ OMRÅDE    : chr  "Hele landet" "København" "Dragør" "Albertslund" ...
-##  $ value     : int  5475791 509861 13261 27602 64412 7986 121 295 65722 7097 ...
+
## 'data.frame':    172720 obs. of  5 variables:
+##  $ TID       : POSIXct, format: "2008-01-01" "2008-01-01" ...
+##  $ CIVILSTAND: chr  "I alt" "I alt" "I alt" "I alt" ...
+##  $ ALDER     : chr  "Alder i alt" "Alder i alt" "Alder i alt" "Alder i alt" ...
+##  $ OMRÅDE    : chr  "Hele landet" "København" "Dragør" "Albertslund" ...
+##  $ value     : int  5475791 509861 13261 27602 64412 7986 121 295 65722 7097 ...

I can also build a query beforehand and then use the query in the query parameter. This might be a good way to split your script up into smaller pieces and make it more structured.

You might have noticed that I use the * as a value in the TID variable. You can use the star as a alternative to writing all the text values for the variable.

-
+
 my_query <- list(
   OMRÅDE = c("Hele landet", "København", "Frederiksberg", "Odense"),
   CIVILSTAND = "Ugift",
@@ -284,17 +293,17 @@ 

Get data) str(dst_get_data(table = "folk1a", query = my_query, lang = "da"))

-
## 'data.frame':    272 obs. of  4 variables:
-##  $ OMRÅDE    : chr  "Hele landet" "Hele landet" "Hele landet" "Hele landet" ...
-##  $ CIVILSTAND: chr  "Ugift" "Ugift" "Ugift" "Ugift" ...
-##  $ TID       : POSIXct, format: "2008-01-01" "2008-04-01" ...
-##  $ value     : int  2552700 2563134 2564705 2568255 2575185 2584993 2584560 2588198 2593172 2604129 ...
-
+
## 'data.frame':    272 obs. of  4 variables:
+##  $ OMRÅDE    : chr  "Hele landet" "Hele landet" "Hele landet" "Hele landet" ...
+##  $ CIVILSTAND: chr  "Ugift" "Ugift" "Ugift" "Ugift" ...
+##  $ TID       : POSIXct, format: "2008-01-01" "2008-04-01" ...
+##  $ value     : int  2552700 2563134 2564705 2568255 2575185 2584993 2584560 2588198 2593172 2604129 ...
+
 str(dst_get_data(table = "AUP01", OMRÅDE = c("Hele landet"), TID = "*", lang = "da"))
-
## 'data.frame':    87 obs. of  3 variables:
-##  $ OMRÅDE: chr  "Hele landet" "Hele landet" "Hele landet" "Hele landet" ...
-##  $ TID   : POSIXct, format: "2017-07-01" "2017-08-01" ...
-##  $ value : num  4 4.1 3.9 4 4 4.1 4.2 4.2 4.1 3.7 ...
+
## 'data.frame':    87 obs. of  3 variables:
+##  $ OMRÅDE: chr  "Hele landet" "Hele landet" "Hele landet" "Hele landet" ...
+##  $ TID   : POSIXct, format: "2017-07-01" "2017-08-01" ...
+##  $ value : num  4 4.1 3.9 4 4 4.1 4.2 4.2 4.1 3.7 ...

If you run into problems, then try to set the parse_dst_tid parameter to FALSE as there are few datasets with non-standard date formats.

Don’t hesitate to submit an issue or question on github and I’ll try to help as much as I can.

diff --git a/pkgdown.yml b/pkgdown.yml index 9b90e5f..134f274 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 3.1.11 pkgdown: 2.1.1 pkgdown_sha: ~ articles: {} -last_built: 2024-11-27T23:15Z +last_built: 2024-11-28T07:43Z urls: reference: https://ropengov.github.io/dkstat/reference article: https://ropengov.github.io/dkstat/articles diff --git a/reference/index.html b/reference/index.html index 758ec0b..ce1cacc 100644 --- a/reference/index.html +++ b/reference/index.html @@ -108,13 +108,7 @@

All functionstables_da - - -
Cached list of all available tables with danish names and descriptions
-
- - tables_en + tables
Cached list of all available tables
diff --git a/reference/tables.html b/reference/tables.html new file mode 100644 index 0000000..5ac334f --- /dev/null +++ b/reference/tables.html @@ -0,0 +1,97 @@ + +Cached list of all available tables — tables • dkstat + Skip to contents + + +
+
+
+ +
+

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

+ + +
+ +
+ +
+ + +
+ + + + + + diff --git a/search.json b/search.json index 63dc619..08ef1b6 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://ropengov.github.io/dkstat/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Aleksander Bang-Larsen. Author, maintainer. Kenneth Rose. Author. Thomas J. leeper. Contributor.","code":""},{"path":"https://ropengov.github.io/dkstat/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Kenneth Rose (2024). dkstat: API connection StatBank Statistics Denmark. R package version 0.09.","code":"@Manual{, title = {dkstat: API connection to the StatBank from Statistics Denmark}, author = {Kenneth Rose}, year = {2024}, note = {R package version 0.09}, }"},{"path":[]},{"path":"https://ropengov.github.io/dkstat/index.html","id":"dkstat-","dir":"","previous_headings":"","what":"dkstat","title":"API connection to the StatBank from Statistics Denmark","text":"package connects StatBank API Statistics Denmark. package early BETA new changes likely backward compatibility.","code":""},{"path":"https://ropengov.github.io/dkstat/index.html","id":"a-short-message-in-danish","dir":"","previous_headings":"","what":"A short message in Danish","title":"API connection to the StatBank from Statistics Denmark","text":"Denne R Statistics pakke indeholder funktioner til give dig adgang til data gennem API’en fra Danmarks Statistik. Funktionerne henter data fra Statistikbanken og retunerer data.frame objekter med værdierne du spørger efter dit funktionskald.","code":""},{"path":"https://ropengov.github.io/dkstat/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"API connection to the StatBank from Statistics Denmark","text":"can install development version github, using Hadley Wickham’s devtools package:","code":"if(!require(\"devtools\")) install.packages(\"devtools\") library(\"devtools\") install_github(\"rOpenGov/dkstat\")"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"examples","dir":"","previous_headings":"","what":"Examples","title":"API connection to the StatBank from Statistics Denmark","text":"default language danish, got lang parameter can change “da” “en” wan’t data returned English.","code":""},{"path":"https://ropengov.github.io/dkstat/index.html","id":"four-basic-function","dir":"","previous_headings":"Examples","what":"Four basic function","title":"API connection to the StatBank from Statistics Denmark","text":"four basic functions learn: dst_search() function makes possible search different tables word phrase. dst_tables() function downloads possible tables available. dst_meta() function lets download meta data specific table, can see description, unit, variables values can download data . dst_get_data() lets download actual data wan’t. simple examples go basics requesting data StatBank structure output. First, ’ll load package:","code":"library(dkstat)"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"the-search-function","dir":"","previous_headings":"","what":"The search function","title":"API connection to the StatBank from Statistics Denmark","text":"search function let’s .. OK, might know already. search gdp text field tables.","code":"dst_search(string = \"bnp\", field = \"text\") ## id ## 584 NAN1 ## 588 NKN1 ## 593 NAHL2 ## 596 NKHO2 ## 599 NAHO2 ## 602 NAHD21 ## 669 NRHP ## 670 VNRHP ## 1318 CFABNP ## text ## 584 Forsyningsbalance, bruttonationalprodukt (BNP),økonomisk vækst, beskæftigelse mv. ## 588 Forsyningsbalance, Bruttonationalprodukt (BNP), beskæftigelse mv. ## 593 1-2.1.1 Produktion, BNP og indkomstdannelse (hovedposter) ## 596 1-2.1.1 Produktion, BNP og indkomstdannelse ## 599 1-2.1.1 Produktion, BNP og indkomstdannelse (oversigt) ## 602 1 Produktion og BNP (detaljeret) ## 669 1-2.1.1 Produktion, BNP og indkomstdannelse ## 670 Versionstabel NRHP - Produktion, BNP og indkomstdannelse ## 1318 FoU udgifter i pct. af BNP ## unit updated firstPeriod latestPeriod active ## 584 - 2024-10-03T08:00:00 1966 2023 TRUE ## 588 - 2024-11-20T08:00:00 1990K1 2024K3 TRUE ## 593 Mio. kr. 2024-06-28T08:00:00 1966 2023 TRUE ## 596 Mio. kr. 2024-11-20T08:00:00 1990K1 2024K3 TRUE ## 599 Mio. kr. 2024-06-28T08:00:00 1995 2023 TRUE ## 602 Mio. kr. 2024-06-28T08:00:00 1995 2023 TRUE ## 669 - 2024-10-28T08:00:00 1993 2023 TRUE ## 670 - 2024-10-28T08:00:00 1993 2023 TRUE ## 1318 Pct. af bnp 2023-12-14T08:00:00 1997 2022 TRUE ## variables ## 584 transaktion, prisenhed, tid ## 588 transaktion, prisenhed, sæsonkorrigering, tid ## 593 transaktion, prisenhed, tid ## 596 transaktion, prisenhed, sæsonkorrigering, tid ## 599 transaktion, prisenhed, tid ## 602 transaktion, prisenhed, tid ## 669 område, transaktion, prisenhed, tid ## 670 version, område, transaktion, prisenhed, tid ## 1318 pct af BNP, tid"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"download-the-tables","dir":"","previous_headings":"","what":"Download the tables","title":"API connection to the StatBank from Statistics Denmark","text":"dst_get_tables function downloads available tables search function use searching word phrase.","code":"head(dst_get_tables(lang = \"da\")) ## id text unit updated ## 1 FOLK1A Befolkningen den 1. i kvartalet Antal 2024-11-11T08:00:00 ## 2 FOLK1AM Befolkningen den 1. i måneden Antal 2024-11-11T08:00:00 ## 3 BEFOLK1 Befolkningen 1. januar Antal 2024-02-12T08:00:00 ## 4 BEFOLK2 Befolkningen 1. januar Antal 2024-02-12T08:00:00 ## 5 FOLK3 Befolkningen 1. januar Antal 2024-02-12T08:00:00 ## 6 FOLK3FOD Befolkningen 1. januar Antal 2024-02-12T08:00:00 ## firstPeriod latestPeriod active variables ## 1 2008K1 2024K4 TRUE område,køn,alder,civilstand,tid ## 2 2021M10 2024M10 TRUE område,køn,alder,tid ## 3 1971 2024 TRUE køn,alder,civilstand,tid ## 4 1901 2024 TRUE køn,alder,tid ## 5 2008 2024 TRUE fødselsdag,fødselsmåned,fødselsår,tid ## 6 2008 2024 TRUE fødselsdag,fødselsmåned,fødeland,tid"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"meta-data","dir":"","previous_headings":"","what":"Meta data","title":"API connection to the StatBank from Statistics Denmark","text":"dst_meta function retrieves meta data table wan’t take closer look . can used create final request, can figure structure query can define . ’ll get meta data AULAAR table. AULAAR table net unemployment numbers. ‘dst_meta’ function returns list 4 objects: - basics - variables - values - basic_query","code":"aulaar_meta <- dst_meta(table = \"AULAAR\", lang = \"da\")"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"basics","dir":"","previous_headings":"Meta data","what":"Basics","title":"API connection to the StatBank from Statistics Denmark","text":"Let’s see basics contains: ’s table id, short description, unit description table updated.","code":"aulaar_meta$basics ## $id ## [1] \"AULAAR\" ## ## $text ## [1] \"Fuldtidsledige (netto)\" ## ## $description ## [1] \"Fuldtidsledige (netto) efter køn, personer/pct. og tid\" ## ## $unit ## [1] \"Antal\" ## ## $updated ## [1] \"2024-04-16T08:00:00\" ## ## $footnote ## NULL"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"variables","dir":"","previous_headings":"Meta data","what":"Variables","title":"API connection to the StatBank from Statistics Denmark","text":"variables list short description variable well id. might want make sure supplied ID’s elimination columns equal FALSE. IDs eliminnation equal FALSE mandatory.","code":"aulaar_meta$variables ## id text elimination ## 1 KØN køn TRUE ## 2 PERPCT personer/pct. FALSE ## 3 Tid tid FALSE"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"values","dir":"","previous_headings":"Meta data","what":"Values","title":"API connection to the StatBank from Statistics Denmark","text":"values list object values variable. use text column construct final query:","code":"str(aulaar_meta$values) ## List of 3 ## $ KØN :'data.frame': 3 obs. of 2 variables: ## ..$ id : chr [1:3] \"TOT\" \"M\" \"K\" ## ..$ text: chr [1:3] \"I alt\" \"Mænd\" \"Kvinder\" ## $ PERPCT:'data.frame': 2 obs. of 2 variables: ## ..$ id : chr [1:2] \"L10\" \"L9\" ## ..$ text: chr [1:2] \"Procent af arbejdsstyrken\" \"Ledige (1000 personer)\" ## $ Tid :'data.frame': 45 obs. of 2 variables: ## ..$ id : chr [1:45] \"1979\" \"1980\" \"1981\" \"1982\" ... ## ..$ text: chr [1:45] \"1979\" \"1980\" \"1981\" \"1982\" ..."},{"path":"https://ropengov.github.io/dkstat/index.html","id":"get-data","dir":"","previous_headings":"","what":"Get data","title":"API connection to the StatBank from Statistics Denmark","text":"need build query based text column variable contains meta_data$values list. request don’t supply meta_data dst_get_data function, possible show . ’s good idea supply meta data dst_get_data function query table . don’t supply meta data dst_get_data function request meta data table ineffecient. Let’s query statbank using one value variable. can also build query beforehand use query query parameter. might good way split script smaller pieces make structured. might noticed use * value TID variable. can use star alternative writing text values variable. run problems, try set parse_dst_tid parameter FALSE datasets non-standard date formats. Don’t hesitate submit issue question github ’ll try help much can.","code":"aulaar <- dst_get_data( table = \"AULAAR\", KØN = \"Total\", PERPCT = \"Per cent of the labour force\", Tid = 2013, lang = \"en\" ) str(aulaar) ## 'data.frame': 1 obs. of 4 variables: ## $ KØN : chr \"Total\" ## $ PERPCT: chr \"Per cent of the labour force\" ## $ TID : POSIXct, format: \"2013-01-01\" ## $ value : num 4.4 folk1a_meta <- dst_meta(\"folk1a\", lang = \"da\") str(dst_get_data( table = \"folk1a\", Tid = \"*\", CIVILSTAND = \"*\", ALDER = \"*\", OMRÅDE = c(\"Hele landet\", \"København\", \"Dragør\", \"Albertslund\"), lang = \"da\", meta_data = folk1a_meta )) ## 'data.frame': 172720 obs. of 5 variables: ## $ TID : POSIXct, format: \"2008-01-01\" \"2008-01-01\" ... ## $ CIVILSTAND: chr \"I alt\" \"I alt\" \"I alt\" \"I alt\" ... ## $ ALDER : chr \"Alder i alt\" \"Alder i alt\" \"Alder i alt\" \"Alder i alt\" ... ## $ OMRÅDE : chr \"Hele landet\" \"København\" \"Dragør\" \"Albertslund\" ... ## $ value : int 5475791 509861 13261 27602 64412 7986 121 295 65722 7097 ... my_query <- list( OMRÅDE = c(\"Hele landet\", \"København\", \"Frederiksberg\", \"Odense\"), CIVILSTAND = \"Ugift\", TID = \"*\" ) str(dst_get_data(table = \"folk1a\", query = my_query, lang = \"da\")) ## 'data.frame': 272 obs. of 4 variables: ## $ OMRÅDE : chr \"Hele landet\" \"Hele landet\" \"Hele landet\" \"Hele landet\" ... ## $ CIVILSTAND: chr \"Ugift\" \"Ugift\" \"Ugift\" \"Ugift\" ... ## $ TID : POSIXct, format: \"2008-01-01\" \"2008-04-01\" ... ## $ value : int 2552700 2563134 2564705 2568255 2575185 2584993 2584560 2588198 2593172 2604129 ... str(dst_get_data(table = \"AUP01\", OMRÅDE = c(\"Hele landet\"), TID = \"*\", lang = \"da\")) ## 'data.frame': 87 obs. of 3 variables: ## $ OMRÅDE: chr \"Hele landet\" \"Hele landet\" \"Hele landet\" \"Hele landet\" ... ## $ TID : POSIXct, format: \"2017-07-01\" \"2017-08-01\" ... ## $ value : num 4 4.1 3.9 4 4 4.1 4.2 4.2 4.1 3.7 ..."},{"path":"https://ropengov.github.io/dkstat/reference/dst_correct_url.html","id":null,"dir":"Reference","previous_headings":"","what":"Corrects url encoding for Danish letters. — dst_correct_url","title":"Corrects url encoding for Danish letters. — dst_correct_url","text":"Corrects url encoding Danish letters.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_correct_url.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Corrects url encoding for Danish letters. — dst_correct_url","text":"","code":"dst_correct_url(url)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_correct_url.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Corrects url encoding for Danish letters. — dst_correct_url","text":"url build url.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_date_parse.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper function to parse the dates from the statbank. — dst_date_parse","title":"Helper function to parse the dates from the statbank. — dst_date_parse","text":"Helper function parse dates statbank.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_date_parse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper function to parse the dates from the statbank. — dst_date_parse","text":"","code":"dst_date_parse(dst_date)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_date_parse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper function to parse the dates from the statbank. — dst_date_parse","text":"dst_date vector length one date formats like 1982M12D09, 1982M12, 1982Q4 1982","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_date_parse.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper function to parse the dates from the statbank. — dst_date_parse","text":"Returns input date formatted Europe/Copenhagen","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_find_val_id.html","id":null,"dir":"Reference","previous_headings":"","what":"This is a helper function to extract the ID's in the values list that the dst_meta function returns. — dst_find_val_id","title":"This is a helper function to extract the ID's in the values list that the dst_meta function returns. — dst_find_val_id","text":"helper function extract ID's values list dst_meta function returns.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_find_val_id.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This is a helper function to extract the ID's in the values list that the dst_meta function returns. — dst_find_val_id","text":"","code":"dst_find_val_id(meta_data, variable, values_text = NULL)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_find_val_id.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This is a helper function to extract the ID's in the values list that the dst_meta function returns. — dst_find_val_id","text":"meta_data meta data object. variable variable search . values_text Character vector. values want extract IDs . NULL, returned value \"*\".","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_all_data.html","id":null,"dir":"Reference","previous_headings":"","what":"This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_all_data","title":"This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_all_data","text":"Get data table StatBank. function provides query parameters user's behalf. , user, need specify anything table name given entire contents table nice long format. useful , like filter table e.g. {dplyr} functions save entire table archival.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_all_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_all_data","text":"","code":"dst_get_all_data(table, lang = \"da\", parse_dst_tid = TRUE)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_all_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_all_data","text":"table Table StatBank. lang language. \"en\" english \"da\" danish. parse_dst_tid Logical. Default TRUE. date first day period time zone \"UTC\" Danish \"CET\".","code":""},{"path":[]},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_all_data.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_all_data","text":"Aleksander Bang-Larsen contact@aleksanderbl.dk","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_data.html","id":null,"dir":"Reference","previous_headings":"","what":"This function returns the requested data from the StatBank table. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_data","title":"This function returns the requested data from the StatBank table. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_data","text":"Get data table StatBank.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This function returns the requested data from the StatBank table. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_data","text":"","code":"dst_get_data( table, ..., query = NULL, parse_dst_tid = TRUE, lang = \"da\", meta_data = NULL, format = \"CSV\", value_presentation = \"Value\" )"},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This function returns the requested data from the StatBank table. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_data","text":"table Table StatBank. ... Build query. query list object query. parse_dst_tid Logical. Default TRUE. date first day period time zone \"UTC\" Danish \"CET\". lang language. \"en\" english \"da\" danish. meta_data Meta data table. NULL meta data requested. format character value. \"CSV\" \"BULK\". choose BULK need select value parameters. value_presentation now, \"value\" \"default\"","code":""},{"path":[]},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"This functions downloads all the available tables. — dst_get_tables","title":"This functions downloads all the available tables. — dst_get_tables","text":"functions downloads available tables.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This functions downloads all the available tables. — dst_get_tables","text":"","code":"dst_get_tables(lang = \"da\")"},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This functions downloads all the available tables. — dst_get_tables","text":"lang \"da\" (danish) \"en\" (english)","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta.html","id":null,"dir":"Reference","previous_headings":"","what":"This function returns meta data for a table from StatBank Denmark / Statistics Denmark. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta","title":"This function returns meta data for a table from StatBank Denmark / Statistics Denmark. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta","text":"function POSTs request meta data table Statistics Denmark returns JSON object information.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This function returns meta data for a table from StatBank Denmark / Statistics Denmark. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta","text":"","code":"dst_meta(table, ..., lang = \"da\")"},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This function returns meta data for a table from StatBank Denmark / Statistics Denmark. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta","text":"table name table want meta data . ... Ignored. lang can choose \"en\" english \"da\" danish.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta_parse.html","id":null,"dir":"Reference","previous_headings":"","what":"This function parses the JSON from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta_parse","title":"This function parses the JSON from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta_parse","text":"function structures JSON data bit creates basic_query. tables large, basic request rather simple. function returns list basic data, info available variables list basic request.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta_parse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This function parses the JSON from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta_parse","text":"","code":"dst_meta_parse(meta, lang)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta_parse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This function parses the JSON from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta_parse","text":"meta returned meta data function meta_dst. lang language orignal dst_meta function (due error API)","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_query_match.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper function to return ids based on text values — dst_query_match","title":"Helper function to return ids based on text values — dst_query_match","text":"helper function return ids based text values.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_query_match.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper function to return ids based on text values — dst_query_match","text":"","code":"dst_query_match(table, lang, meta_data, query, format)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_query_match.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper function to return ids based on text values — dst_query_match","text":"table Table StatBank. lang language. \"en\" english \"da\" danish. meta_data meta data object extract values query query match format Format specify match csv import (used)","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_search.html","id":null,"dir":"Reference","previous_headings":"","what":"This function provides a search function for the description field of available data series — dst_search","title":"This function provides a search function for the description field of available data series — dst_search","text":"function provides search function description field available data series","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_search.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This function provides a search function for the description field of available data series — dst_search","text":"","code":"dst_search(string = \"gpd\", field = \"text\", lang = \"da\", use_cache = NULL)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_search.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This function provides a search function for the description field of available data series — dst_search","text":"string Character string. Speficies search term. field Character string. lang Character. \"da\" danish \"en\" english. use_cache logical scalar. function call Statbank use (possibly outdated) saved version tables?","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_value_limit.html","id":null,"dir":"Reference","previous_headings":"","what":"This is a helper function that returns the number of values the call will return. The API has a limit of 100.000 values. — dst_value_limit","title":"This is a helper function that returns the number of values the call will return. The API has a limit of 100.000 values. — dst_value_limit","text":"helper function returns number values call return. API limit 100.000 values.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_value_limit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This is a helper function that returns the number of values the call will return. The API has a limit of 100.000 values. — dst_value_limit","text":"","code":"dst_value_limit(query, dst_meta)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_value_limit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This is a helper function that returns the number of values the call will return. The API has a limit of 100.000 values. — dst_value_limit","text":"query Query object analyse dst_meta Meta data filer query ","code":""},{"path":"https://ropengov.github.io/dkstat/reference/tables_da.html","id":null,"dir":"Reference","previous_headings":"","what":"Cached list of all available tables with danish names and descriptions — tables_da","title":"Cached list of all available tables with danish names and descriptions — tables_da","text":"Cached list available tables danish names descriptions","code":""},{"path":"https://ropengov.github.io/dkstat/reference/tables_da.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cached list of all available tables with danish names and descriptions — tables_da","text":"","code":"tables_da"},{"path":[]},{"path":"https://ropengov.github.io/dkstat/reference/tables_da.html","id":"tables-da","dir":"Reference","previous_headings":"","what":"tables_da","title":"Cached list of all available tables with danish names and descriptions — tables_da","text":"data frame 2339 rows 8 columns: id Unique ID table text Description table unit unit values represented table updated table last updated firstPeriod time first observation table latestPeriod time latest observation table active Binary indicator table active variables List variables table","code":""},{"path":"https://ropengov.github.io/dkstat/reference/tables_en.html","id":null,"dir":"Reference","previous_headings":"","what":"Cached list of all available tables — tables_en","title":"Cached list of all available tables — tables_en","text":"Cached list available tables","code":""},{"path":"https://ropengov.github.io/dkstat/reference/tables_en.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cached list of all available tables — tables_en","text":"","code":"tables_en"},{"path":[]},{"path":"https://ropengov.github.io/dkstat/reference/tables_en.html","id":"tables-en","dir":"Reference","previous_headings":"","what":"tables_en","title":"Cached list of all available tables — tables_en","text":"data frame 2339 rows 8 columns: id Unique ID table text Description table unit unit values represented table updated table last updated firstPeriod time first observation table latestPeriod time latest observation table active Binary indicator table active variables List variables table","code":""}] +[{"path":"https://ropengov.github.io/dkstat/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Aleksander Bang-Larsen. Author, maintainer. Kenneth Rose. Author. Thomas J. leeper. Contributor.","code":""},{"path":"https://ropengov.github.io/dkstat/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Kenneth Rose (2024). dkstat: API connection StatBank Statistics Denmark. R package version 0.09.","code":"@Manual{, title = {dkstat: API connection to the StatBank from Statistics Denmark}, author = {Kenneth Rose}, year = {2024}, note = {R package version 0.09}, }"},{"path":[]},{"path":"https://ropengov.github.io/dkstat/index.html","id":"dkstat-","dir":"","previous_headings":"","what":"dkstat","title":"API connection to the StatBank from Statistics Denmark","text":"package connects StatBank API Statistics Denmark. package early BETA new changes likely backward compatibility.","code":""},{"path":"https://ropengov.github.io/dkstat/index.html","id":"a-short-message-in-danish","dir":"","previous_headings":"","what":"A short message in Danish","title":"API connection to the StatBank from Statistics Denmark","text":"Denne R Statistics pakke indeholder funktioner til give dig adgang til data gennem API’en fra Danmarks Statistik. Funktionerne henter data fra Statistikbanken og retunerer data.frame objekter med værdierne du spørger efter dit funktionskald.","code":""},{"path":"https://ropengov.github.io/dkstat/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"API connection to the StatBank from Statistics Denmark","text":"can install dkstat r-universe : can install latest development version dkstat GitHub :","code":"install.packages( \"dkstat\", repos = c( ropengov = \"https://ropengov.r-universe.dev\", getOption(\"repos\") ) ) # install.packages(\"devtools\") devtools::install_github(\"rOpenGov/dkstat\")"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"examples","dir":"","previous_headings":"","what":"Examples","title":"API connection to the StatBank from Statistics Denmark","text":"default language danish, got lang parameter can change “da” “en” wan’t data returned English.","code":""},{"path":"https://ropengov.github.io/dkstat/index.html","id":"four-basic-function","dir":"","previous_headings":"Examples","what":"Four basic function","title":"API connection to the StatBank from Statistics Denmark","text":"four basic functions learn: dst_search() function makes possible search different tables word phrase. dst_tables() function downloads possible tables available. dst_meta() function lets download meta data specific table, can see description, unit, variables values can download data . dst_get_data() lets download actual data wan’t. simple examples go basics requesting data StatBank structure output. First, ’ll load package:","code":"library(dkstat)"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"the-search-function","dir":"","previous_headings":"","what":"The search function","title":"API connection to the StatBank from Statistics Denmark","text":"search function let’s .. OK, might know already. search gdp text field tables.","code":"dst_search(string = \"bnp\", field = \"text\") ## id ## 584 NAN1 ## 588 NKN1 ## 593 NAHL2 ## 596 NKHO2 ## 599 NAHO2 ## 602 NAHD21 ## 669 NRHP ## 670 VNRHP ## 1318 CFABNP ## text ## 584 Forsyningsbalance, bruttonationalprodukt (BNP),økonomisk vækst, beskæftigelse mv. ## 588 Forsyningsbalance, Bruttonationalprodukt (BNP), beskæftigelse mv. ## 593 1-2.1.1 Produktion, BNP og indkomstdannelse (hovedposter) ## 596 1-2.1.1 Produktion, BNP og indkomstdannelse ## 599 1-2.1.1 Produktion, BNP og indkomstdannelse (oversigt) ## 602 1 Produktion og BNP (detaljeret) ## 669 1-2.1.1 Produktion, BNP og indkomstdannelse ## 670 Versionstabel NRHP - Produktion, BNP og indkomstdannelse ## 1318 FoU udgifter i pct. af BNP ## unit updated firstPeriod latestPeriod active ## 584 - 2024-10-03T08:00:00 1966 2023 TRUE ## 588 - 2024-11-20T08:00:00 1990K1 2024K3 TRUE ## 593 Mio. kr. 2024-06-28T08:00:00 1966 2023 TRUE ## 596 Mio. kr. 2024-11-20T08:00:00 1990K1 2024K3 TRUE ## 599 Mio. kr. 2024-06-28T08:00:00 1995 2023 TRUE ## 602 Mio. kr. 2024-06-28T08:00:00 1995 2023 TRUE ## 669 - 2024-10-28T08:00:00 1993 2023 TRUE ## 670 - 2024-10-28T08:00:00 1993 2023 TRUE ## 1318 Pct. af bnp 2023-12-14T08:00:00 1997 2022 TRUE ## variables ## 584 transaktion, prisenhed, tid ## 588 transaktion, prisenhed, sæsonkorrigering, tid ## 593 transaktion, prisenhed, tid ## 596 transaktion, prisenhed, sæsonkorrigering, tid ## 599 transaktion, prisenhed, tid ## 602 transaktion, prisenhed, tid ## 669 område, transaktion, prisenhed, tid ## 670 version, område, transaktion, prisenhed, tid ## 1318 pct af BNP, tid"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"download-the-tables","dir":"","previous_headings":"","what":"Download the tables","title":"API connection to the StatBank from Statistics Denmark","text":"dst_get_tables function downloads available tables search function use searching word phrase.","code":"head(dst_get_tables(lang = \"da\")) ## id text unit updated ## 1 FOLK1A Befolkningen den 1. i kvartalet Antal 2024-11-11T08:00:00 ## 2 FOLK1AM Befolkningen den 1. i måneden Antal 2024-11-11T08:00:00 ## 3 BEFOLK1 Befolkningen 1. januar Antal 2024-02-12T08:00:00 ## 4 BEFOLK2 Befolkningen 1. januar Antal 2024-02-12T08:00:00 ## 5 FOLK3 Befolkningen 1. januar Antal 2024-02-12T08:00:00 ## 6 FOLK3FOD Befolkningen 1. januar Antal 2024-02-12T08:00:00 ## firstPeriod latestPeriod active variables ## 1 2008K1 2024K4 TRUE område,køn,alder,civilstand,tid ## 2 2021M10 2024M10 TRUE område,køn,alder,tid ## 3 1971 2024 TRUE køn,alder,civilstand,tid ## 4 1901 2024 TRUE køn,alder,tid ## 5 2008 2024 TRUE fødselsdag,fødselsmåned,fødselsår,tid ## 6 2008 2024 TRUE fødselsdag,fødselsmåned,fødeland,tid"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"meta-data","dir":"","previous_headings":"","what":"Meta data","title":"API connection to the StatBank from Statistics Denmark","text":"dst_meta function retrieves meta data table wan’t take closer look . can used create final request, can figure structure query can define . ’ll get meta data AULAAR table. AULAAR table net unemployment numbers. ‘dst_meta’ function returns list 4 objects: - basics - variables - values - basic_query","code":"aulaar_meta <- dst_meta(table = \"AULAAR\", lang = \"da\")"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"basics","dir":"","previous_headings":"Meta data","what":"Basics","title":"API connection to the StatBank from Statistics Denmark","text":"Let’s see basics contains: ’s table id, short description, unit description table updated.","code":"aulaar_meta$basics ## $id ## [1] \"AULAAR\" ## ## $text ## [1] \"Fuldtidsledige (netto)\" ## ## $description ## [1] \"Fuldtidsledige (netto) efter køn, personer/pct. og tid\" ## ## $unit ## [1] \"Antal\" ## ## $updated ## [1] \"2024-04-16T08:00:00\" ## ## $footnote ## NULL"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"variables","dir":"","previous_headings":"Meta data","what":"Variables","title":"API connection to the StatBank from Statistics Denmark","text":"variables list short description variable well id. might want make sure supplied ID’s elimination columns equal FALSE. IDs eliminnation equal FALSE mandatory.","code":"aulaar_meta$variables ## id text elimination ## 1 KØN køn TRUE ## 2 PERPCT personer/pct. FALSE ## 3 Tid tid FALSE"},{"path":"https://ropengov.github.io/dkstat/index.html","id":"values","dir":"","previous_headings":"Meta data","what":"Values","title":"API connection to the StatBank from Statistics Denmark","text":"values list object values variable. use text column construct final query:","code":"str(aulaar_meta$values) ## List of 3 ## $ KØN :'data.frame': 3 obs. of 2 variables: ## ..$ id : chr [1:3] \"TOT\" \"M\" \"K\" ## ..$ text: chr [1:3] \"I alt\" \"Mænd\" \"Kvinder\" ## $ PERPCT:'data.frame': 2 obs. of 2 variables: ## ..$ id : chr [1:2] \"L10\" \"L9\" ## ..$ text: chr [1:2] \"Procent af arbejdsstyrken\" \"Ledige (1000 personer)\" ## $ Tid :'data.frame': 45 obs. of 2 variables: ## ..$ id : chr [1:45] \"1979\" \"1980\" \"1981\" \"1982\" ... ## ..$ text: chr [1:45] \"1979\" \"1980\" \"1981\" \"1982\" ..."},{"path":"https://ropengov.github.io/dkstat/index.html","id":"get-data","dir":"","previous_headings":"","what":"Get data","title":"API connection to the StatBank from Statistics Denmark","text":"need build query based text column variable contains meta_data$values list. request don’t supply meta_data dst_get_data function, possible show . ’s good idea supply meta data dst_get_data function query table . don’t supply meta data dst_get_data function request meta data table ineffecient. Let’s query statbank using one value variable. can also build query beforehand use query query parameter. might good way split script smaller pieces make structured. might noticed use * value TID variable. can use star alternative writing text values variable. run problems, try set parse_dst_tid parameter FALSE datasets non-standard date formats. Don’t hesitate submit issue question github ’ll try help much can.","code":"aulaar <- dst_get_data( table = \"AULAAR\", KØN = \"Total\", PERPCT = \"Per cent of the labour force\", Tid = 2013, lang = \"en\" ) str(aulaar) ## 'data.frame': 1 obs. of 4 variables: ## $ KØN : chr \"Total\" ## $ PERPCT: chr \"Per cent of the labour force\" ## $ TID : POSIXct, format: \"2013-01-01\" ## $ value : num 4.4 folk1a_meta <- dst_meta(\"folk1a\", lang = \"da\") str(dst_get_data( table = \"folk1a\", Tid = \"*\", CIVILSTAND = \"*\", ALDER = \"*\", OMRÅDE = c(\"Hele landet\", \"København\", \"Dragør\", \"Albertslund\"), lang = \"da\", meta_data = folk1a_meta )) ## 'data.frame': 172720 obs. of 5 variables: ## $ TID : POSIXct, format: \"2008-01-01\" \"2008-01-01\" ... ## $ CIVILSTAND: chr \"I alt\" \"I alt\" \"I alt\" \"I alt\" ... ## $ ALDER : chr \"Alder i alt\" \"Alder i alt\" \"Alder i alt\" \"Alder i alt\" ... ## $ OMRÅDE : chr \"Hele landet\" \"København\" \"Dragør\" \"Albertslund\" ... ## $ value : int 5475791 509861 13261 27602 64412 7986 121 295 65722 7097 ... my_query <- list( OMRÅDE = c(\"Hele landet\", \"København\", \"Frederiksberg\", \"Odense\"), CIVILSTAND = \"Ugift\", TID = \"*\" ) str(dst_get_data(table = \"folk1a\", query = my_query, lang = \"da\")) ## 'data.frame': 272 obs. of 4 variables: ## $ OMRÅDE : chr \"Hele landet\" \"Hele landet\" \"Hele landet\" \"Hele landet\" ... ## $ CIVILSTAND: chr \"Ugift\" \"Ugift\" \"Ugift\" \"Ugift\" ... ## $ TID : POSIXct, format: \"2008-01-01\" \"2008-04-01\" ... ## $ value : int 2552700 2563134 2564705 2568255 2575185 2584993 2584560 2588198 2593172 2604129 ... str(dst_get_data(table = \"AUP01\", OMRÅDE = c(\"Hele landet\"), TID = \"*\", lang = \"da\")) ## 'data.frame': 87 obs. of 3 variables: ## $ OMRÅDE: chr \"Hele landet\" \"Hele landet\" \"Hele landet\" \"Hele landet\" ... ## $ TID : POSIXct, format: \"2017-07-01\" \"2017-08-01\" ... ## $ value : num 4 4.1 3.9 4 4 4.1 4.2 4.2 4.1 3.7 ..."},{"path":"https://ropengov.github.io/dkstat/reference/dst_correct_url.html","id":null,"dir":"Reference","previous_headings":"","what":"Corrects url encoding for Danish letters. — dst_correct_url","title":"Corrects url encoding for Danish letters. — dst_correct_url","text":"Corrects url encoding Danish letters.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_correct_url.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Corrects url encoding for Danish letters. — dst_correct_url","text":"","code":"dst_correct_url(url)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_correct_url.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Corrects url encoding for Danish letters. — dst_correct_url","text":"url build url.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_date_parse.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper function to parse the dates from the statbank. — dst_date_parse","title":"Helper function to parse the dates from the statbank. — dst_date_parse","text":"Helper function parse dates statbank.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_date_parse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper function to parse the dates from the statbank. — dst_date_parse","text":"","code":"dst_date_parse(dst_date)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_date_parse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper function to parse the dates from the statbank. — dst_date_parse","text":"dst_date vector length one date formats like 1982M12D09, 1982M12, 1982Q4 1982","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_date_parse.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper function to parse the dates from the statbank. — dst_date_parse","text":"Returns input date formatted Europe/Copenhagen","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_find_val_id.html","id":null,"dir":"Reference","previous_headings":"","what":"This is a helper function to extract the ID's in the values list that the dst_meta function returns. — dst_find_val_id","title":"This is a helper function to extract the ID's in the values list that the dst_meta function returns. — dst_find_val_id","text":"helper function extract ID's values list dst_meta function returns.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_find_val_id.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This is a helper function to extract the ID's in the values list that the dst_meta function returns. — dst_find_val_id","text":"","code":"dst_find_val_id(meta_data, variable, values_text = NULL)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_find_val_id.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This is a helper function to extract the ID's in the values list that the dst_meta function returns. — dst_find_val_id","text":"meta_data meta data object. variable variable search . values_text Character vector. values want extract IDs . NULL, returned value \"*\".","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_all_data.html","id":null,"dir":"Reference","previous_headings":"","what":"This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_all_data","title":"This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_all_data","text":"Get data table StatBank. function provides query parameters user's behalf. , user, need specify anything table name given entire contents table nice long format. useful , like filter table e.g. {dplyr} functions save entire table archival.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_all_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_all_data","text":"","code":"dst_get_all_data(table, lang = \"da\", parse_dst_tid = TRUE)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_all_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_all_data","text":"table Table StatBank. lang language. \"en\" english \"da\" danish. parse_dst_tid Logical. Default TRUE. date first day period time zone \"UTC\" Danish \"CET\".","code":""},{"path":[]},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_all_data.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"This function returns the entire table requested data from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_all_data","text":"Aleksander Bang-Larsen contact@aleksanderbl.dk","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_data.html","id":null,"dir":"Reference","previous_headings":"","what":"This function returns the requested data from the StatBank table. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_data","title":"This function returns the requested data from the StatBank table. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_data","text":"Get data table StatBank.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This function returns the requested data from the StatBank table. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_data","text":"","code":"dst_get_data( table, ..., query = NULL, parse_dst_tid = TRUE, lang = \"da\", meta_data = NULL, format = \"CSV\", value_presentation = \"Value\" )"},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This function returns the requested data from the StatBank table. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_get_data","text":"table Table StatBank. ... Build query. query list object query. parse_dst_tid Logical. Default TRUE. date first day period time zone \"UTC\" Danish \"CET\". lang language. \"en\" english \"da\" danish. meta_data Meta data table. NULL meta data requested. format character value. \"CSV\" \"BULK\". choose BULK need select value parameters. value_presentation now, \"value\" \"default\"","code":""},{"path":[]},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_tables.html","id":null,"dir":"Reference","previous_headings":"","what":"This functions downloads all the available tables. — dst_get_tables","title":"This functions downloads all the available tables. — dst_get_tables","text":"functions downloads available tables.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This functions downloads all the available tables. — dst_get_tables","text":"","code":"dst_get_tables(lang = \"da\")"},{"path":"https://ropengov.github.io/dkstat/reference/dst_get_tables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This functions downloads all the available tables. — dst_get_tables","text":"lang \"da\" (danish) \"en\" (english)","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta.html","id":null,"dir":"Reference","previous_headings":"","what":"This function returns meta data for a table from StatBank Denmark / Statistics Denmark. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta","title":"This function returns meta data for a table from StatBank Denmark / Statistics Denmark. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta","text":"function POSTs request meta data table Statistics Denmark returns JSON object information.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This function returns meta data for a table from StatBank Denmark / Statistics Denmark. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta","text":"","code":"dst_meta(table, ..., lang = \"da\")"},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This function returns meta data for a table from StatBank Denmark / Statistics Denmark. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta","text":"table name table want meta data . ... Ignored. lang can choose \"en\" english \"da\" danish.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta_parse.html","id":null,"dir":"Reference","previous_headings":"","what":"This function parses the JSON from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta_parse","title":"This function parses the JSON from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta_parse","text":"function structures JSON data bit creates basic_query. tables large, basic request rather simple. function returns list basic data, info available variables list basic request.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta_parse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This function parses the JSON from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta_parse","text":"","code":"dst_meta_parse(meta, lang)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_meta_parse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This function parses the JSON from the StatBank. (http://www.statistikbanken.dk/statbank5a/ or http://www.dst.dk) — dst_meta_parse","text":"meta returned meta data function meta_dst. lang language orignal dst_meta function (due error API)","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_query_match.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper function to return ids based on text values — dst_query_match","title":"Helper function to return ids based on text values — dst_query_match","text":"helper function return ids based text values.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_query_match.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper function to return ids based on text values — dst_query_match","text":"","code":"dst_query_match(table, lang, meta_data, query, format)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_query_match.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper function to return ids based on text values — dst_query_match","text":"table Table StatBank. lang language. \"en\" english \"da\" danish. meta_data meta data object extract values query query match format Format specify match csv import (used)","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_search.html","id":null,"dir":"Reference","previous_headings":"","what":"This function provides a search function for the description field of available data series — dst_search","title":"This function provides a search function for the description field of available data series — dst_search","text":"function provides search function description field available data series","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_search.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This function provides a search function for the description field of available data series — dst_search","text":"","code":"dst_search(string = \"gpd\", field = \"text\", lang = \"da\", use_cache = NULL)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_search.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This function provides a search function for the description field of available data series — dst_search","text":"string Character string. Speficies search term. field Character string. lang Character. \"da\" danish \"en\" english. use_cache logical scalar. function call Statbank use (possibly outdated) saved version tables?","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_value_limit.html","id":null,"dir":"Reference","previous_headings":"","what":"This is a helper function that returns the number of values the call will return. The API has a limit of 100.000 values. — dst_value_limit","title":"This is a helper function that returns the number of values the call will return. The API has a limit of 100.000 values. — dst_value_limit","text":"helper function returns number values call return. API limit 100.000 values.","code":""},{"path":"https://ropengov.github.io/dkstat/reference/dst_value_limit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"This is a helper function that returns the number of values the call will return. The API has a limit of 100.000 values. — dst_value_limit","text":"","code":"dst_value_limit(query, dst_meta)"},{"path":"https://ropengov.github.io/dkstat/reference/dst_value_limit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"This is a helper function that returns the number of values the call will return. The API has a limit of 100.000 values. — dst_value_limit","text":"query Query object analyse dst_meta Meta data filer query ","code":""},{"path":"https://ropengov.github.io/dkstat/reference/tables.html","id":null,"dir":"Reference","previous_headings":"","what":"Cached list of all available tables — tables","title":"Cached list of all available tables — tables","text":"Cached list available tables","code":""},{"path":"https://ropengov.github.io/dkstat/reference/tables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cached list of all available tables — tables","text":"","code":"tables"},{"path":[]},{"path":"https://ropengov.github.io/dkstat/reference/tables.html","id":"tables","dir":"Reference","previous_headings":"","what":"tables","title":"Cached list of all available tables — tables","text":"data frame 2339 rows 8 columns: id Unique ID table text Description table unit unit values represented table updated table last updated firstPeriod time first observation table latestPeriod time latest observation table active Binary indicator table active variables List variables table","code":""}] diff --git a/sitemap.xml b/sitemap.xml index e703817..a6e633b 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -14,7 +14,6 @@ https://ropengov.github.io/dkstat/reference/dst_search.html https://ropengov.github.io/dkstat/reference/dst_value_limit.html https://ropengov.github.io/dkstat/reference/index.html -https://ropengov.github.io/dkstat/reference/tables_da.html -https://ropengov.github.io/dkstat/reference/tables_en.html +https://ropengov.github.io/dkstat/reference/tables.html