You can use this function to retrieve data sets from Statistics Denmark. It also let you choose which variables to return.
dst_download(tableID, vars, lang = "en")
tableID | the data set's ID. See dst_tables() to get the ID. |
---|---|
vars | the variables to return. If not specified it will return time and value of the what the data set measure. |
lang | used language in the data set. Can take the values "da" for danish and "en" for english |
dst_download("folk1a")#> Warning: No vars is specified. Only time will be included#> # A tibble: 38 x 2 #> TID INDHOLD #> <date> <dbl> #> 1 2008-01-01 5475791 #> 2 2008-04-01 5482266 #> 3 2008-07-01 5489022 #> 4 2008-10-01 5505995 #> 5 2009-01-01 5511451 #> 6 2009-04-01 5515287 #> 7 2009-07-01 5519441 #> 8 2009-10-01 5532531 #> 9 2010-01-01 5534738 #> 10 2010-04-01 5540241 #> # ... with 28 more rowsdst_download("folk1a", c("ALDER", "CIVILSTAND"))#> # A tibble: 24,130 x 4 #> TID ALDER CIVILSTAND INDHOLD #> <date> <chr> <chr> <dbl> #> 1 2008-01-01 Total Total 5475791 #> 2 2008-01-01 Total Never married 2552700 #> 3 2008-01-01 Total Married/separated 2176977 #> 4 2008-01-01 Total Widowed 317250 #> 5 2008-01-01 Total Divorced 428864 #> 6 2008-01-01 0 year Total 64412 #> 7 2008-01-01 0 year Never married 64412 #> 8 2008-01-01 0 year Married/separated 0 #> 9 2008-01-01 0 year Widowed 0 #> 10 2008-01-01 0 year Divorced 0 #> # ... with 24,120 more rows