Datasources
The robonomistClient
package aims to make using data
from various sources as easy as possible. The package helps you access
data in a simple standard format, without having to think about how to
extract and wrangle the data.
You can list all available datasources:
library(robonomistClient)
#> Loaded robonomistClient 2.2.20
#> ℹ Set to connect wss://data.robonomist.app
#>
#> ✔ Set to connect wss://data.robonomist.app [19ms]
#>
#>
#>
#>
#> Attaching package: 'robonomistClient'
#>
#>
#> The following object is masked from 'package:utils':
#>
#> data
datasources()
#> ℹ Connecting to robonomistServer at wss://data.robonomist.app
#> ✔ Connecting to robonomistServer at wss://data.robonomist.app [467ms]
#>
#> ℹ Connected successfully to robonomistServer 2.9.22
#> ✔ Connected successfully to robonomistServer 2.9.22 [62ms]
#>
#> ⠙ Requesting datasources
#> ✔ Requesting datasources [180ms]
#> # Robonomist Server Datasources
#> dataset title
#> 1 StatFin Statistics Finland, StatFin database
#> 2 StatFin_Passiivi Statistics Finland, StatFin archive database
#> 3 Vero Finnish Tax Administration statistical database
#> 4 ec European Commission's Business and Consumer Surveys
#> 5 kunnat Key statistics of municipalities, Statistics Finland
#> 6 kunnat Financial data reported by municipalities and joint munic…
#> 7 paavo Statistics Finland's Paavo database
#> 8 tulli Finnish Customs, Uljas Statistical Database
#> 9 luke Statistics database of Natural Resources Institute Finlan…
#> 10 etk Finnish Centre for Pensions' statistical database
#> 11 eurostat Eurostat database
#> 12 ecb ECB Statistical Data Warehouse
#> 13 bundesbank Deutsche Bundesbank time series database
#> 14 oecd OECD database
#> 15 oecd3 OECD database (SDMX-JSON API)
#> 16 oecd OECD database
#> 17 wb World Bank Open Data
#> 18 hsa Greater Helsinki Open Statistical Databases, Aluesarjat
#> 19 helymp Helsinki environmental statistics
#> 20 helhyv Helsinki wellbeing statistics
#> 21 nordstat Nordstat
#> 22 covid European Centre for Disease Prevention and Control COVID-…
#> 23 vipunen Vipunen, Education Statistics Finland
#> 24 epirapo THL Epirapo COVID-19 database
#> 25 sotkanet Sotkanet indicator bank of the Finnish Institute for Heal…
#> 26 maakoto Immigrants and integration statistics, Statistics Finland
#> 27 koto Integration database, Finnish Ministry of Economic Affair…
#> 28 toimipaikkalaskuri Toimipaikkalaskuri database, Statitstics Finland
#> 29 kokeelliset Statistics Finland's experimental statistics
#> 30 traficom Traficom statistics database
#> # ℹ 30 more rows
#> # ℹ 3 more variables: languages <list>, datasource <chr>, available <lgl>
Data tables
All contents are orginized as data tables, which in most cases are
tibble-class objects. The data
function is convenient way
to search and get data tables. To print all available data tables:
data()
#> ⠙ Requesting data
#> ⠹ Requesting data
#> ✔ Requesting data [2.1s]
#>
#> # Robonomist Database search results
#> id title lang
#> <r_id> <chr> <chr>
#> 1 StatFin/adopt/statfin_adopt_pxt_11lv.px Adoptiot muuttujina Vuosi, Syn… fi
#> 2 StatFin/adopt/statfin_adopt_pxt_11lv.px Adoptioner efter År, Födelsela… sv
#> 3 StatFin/adopt/statfin_adopt_pxt_11lv.px Adoptions by Year, Country of … en
#> 4 StatFin/adopt/statfin_adopt_pxt_13qh.px Adoptiot muuttujina Vuosi, Ado… fi
#> 5 StatFin/adopt/statfin_adopt_pxt_13qh.px Adoptioner efter År, Föräldrar… sv
#> 6 StatFin/adopt/statfin_adopt_pxt_13qh.px Adoptions by Year, Parents of … en
#> 7 StatFin/aku/statfin_aku_pxt_12dz.px Aikuiskoulutukseen osallistumi… fi
#> 8 StatFin/aku/statfin_aku_pxt_12dz.px Deltagande i vuxenutbildning (… sv
#> 9 StatFin/aku/statfin_aku_pxt_12dz.px Participation in adult educati… en
#> 10 StatFin/aku/statfin_aku_pxt_12ea.px Aikuiskoulutukseen osallistumi… fi
#> 11 StatFin/aku/statfin_aku_pxt_12ea.px Deltagande i vuxenutbildning (… sv
#> 12 StatFin/aku/statfin_aku_pxt_12ea.px Participation in adult educati… en
#> 13 StatFin/aku/statfin_aku_pxt_14bu.px Aikuiskoulutukseen osallistumi… fi
#> 14 StatFin/aku/statfin_aku_pxt_14bu.px Deltagande i vuxenutbildning (… sv
#> 15 StatFin/aku/statfin_aku_pxt_14bu.px Participation in adult educati… en
#> 16 StatFin/aku/statfin_aku_pxt_14bv.px Aikuiskoulutukseen osallistumi… fi
#> 17 StatFin/aku/statfin_aku_pxt_14bv.px Deltagande i vuxenutbildning (… sv
#> 18 StatFin/aku/statfin_aku_pxt_14bv.px Participation in adult educati… en
#> 19 StatFin/altp/statfin_altp_pxt_12bc.px Bruttokansantuote henkeä kohde… fi
#> 20 StatFin/altp/statfin_altp_pxt_12bc.px Bruttonationalprodukt per pers… sv
#> 21 StatFin/altp/statfin_altp_pxt_12bc.px Gross domestic product per cap… en
#> 22 StatFin/altp/statfin_altp_pxt_12bd.px Tulot ja tuotanto alueittain, … fi
#> 23 StatFin/altp/statfin_altp_pxt_12bd.px Inkomster och produktion per r… sv
#> 24 StatFin/altp/statfin_altp_pxt_12bd.px Income and production by area,… en
#> 25 StatFin/altp/statfin_altp_pxt_12be.px Investoinnit ja kiinteä pääoma… fi
#> 26 StatFin/altp/statfin_altp_pxt_12be.px Investeringar och fast kapital… sv
#> 27 StatFin/altp/statfin_altp_pxt_12be.px Investments and fixed capital … en
#> 28 StatFin/altp/statfin_altp_pxt_12bf.px Kotitalouksien tulot ja menot … fi
#> 29 StatFin/altp/statfin_altp_pxt_12bf.px Hushållens inkomster och utgif… sv
#> 30 StatFin/altp/statfin_altp_pxt_12bf.px Household income and expenditu… en
#> # ℹ 173,281 more rows
The package automatically ensures that the listed data tables are the latest versions available at the datasources.
To get a specific data table, use the tables id.
data("StatFin/synt/statfin_synt_pxt_12dx.px")
#> ⠙ Requesting data
#> ✔ Requesting data [205ms]
#>
#> # Robonomist id: StatFin/synt/statfin_synt_pxt_12dx.px
#> # Title: Väestönmuutokset muuttujina Vuosi ja Tiedot
#> # Last updated: 2024-05-28 08:00:00
#> # Next update: 2025-05-20 08:00:00
#> # A tibble: 3,025 × 3
#> Vuosi Tiedot value
#> * <chr> <chr> <dbl>
#> 1 1749 Elävänä syntyneet 16700
#> 2 1749 Kuolleet 11600
#> 3 1749 Luonnollinen väestönlisäys 5100
#> 4 1749 Kuntien välinen muutto NA
#> 5 1749 Maahanmuutto Suomeen NA
#> 6 1749 Maastamuutto Suomesta NA
#> 7 1749 Nettomaahanmuutto NA
#> 8 1749 Solmitut avioliitot 3900
#> 9 1749 Avioerot NA
#> 10 1749 Kokonaismuutos NA
#> # ℹ 3,015 more rows
You can access the version information, or vintage, of a data table with
data_vintage("StatFin/synt/statfin_synt_pxt_12dx.px")
#> ⠙ Requesting vintage
#> ✔ Requesting vintage [181ms]
#>
#> StatFin/synt/statfin_synt_pxt_12dx.px
#> "2024-05-27 12:23:00 EEST"
You can easily explore all available data tables in the Data Viewer.
To explore available data tables in the Vero
dataset,
for example, use the dataset name with a forward slash as the first
argument in data
, i.e. View(data("Vero/"))
. Or
print the data table listing in your console:
data("Vero/")
#> ⠙ Requesting data
#> ✔ Requesting data [445ms]
#>
#> # Robonomist Database search results
#> id title lang
#> <r_id> <chr> <chr>
#> 1 Vero/Autovero/avt_030.px 3. Verotettujen ajoneuvojen merkki- j… fi
#> 2 Vero/Autovero/avt_030.px 3. Fördelningen enligt märke och mode… sv
#> 3 Vero/Autovero/avt_030.px 3. Distribution of make and model of … en
#> 4 Vero/Autovero/avt_050.px 1. Verotettujen ajoneuvojen lukumäärä… fi
#> 5 Vero/Autovero/avt_050.px 1. Uppgifter om antalet beskattade fo… sv
#> 6 Vero/Autovero/avt_050.px 1. Details on age and number of taxab… en
#> 7 Vero/Autovero/avt_060.px 2. Verotettujen ajoneuvojen autoverot… fi
#> 8 Vero/Autovero/avt_060.px 2. Bilskatten på de fordon som beskat… sv
#> 9 Vero/Autovero/avt_060.px 2. Car tax amounts and taxable values… en
#> 10 Vero/Kiinteistoverot/kive_101.px 1.1 Maksuunpantu kiinteistövero: asia… fi
#> 11 Vero/Kiinteistoverot/kive_101.px 1.1 Debiterad fastighetsskatt: fastig… sv
#> 12 Vero/Kiinteistoverot/kive_101.px 1.1 Real estate tax debited: amount o… en
#> 13 Vero/Kiinteistoverot/kive_102.px 1.2 Maksuunpantu kiinteistövero: asia… fi
#> 14 Vero/Kiinteistoverot/kive_102.px 1.2 Debiterad fastighetsskatt: fastig… sv
#> 15 Vero/Kiinteistoverot/kive_102.px 1.2 Real estate tax debited: amount o… en
#> 16 Vero/Kiinteistoverot/kive_201.px 2.1 Käyttötarkoituksen mukaiset kiint… fi
#> 17 Vero/Kiinteistoverot/kive_201.px 2.1 Fastighetsbeskattningsuppgifter e… sv
#> 18 Vero/Kiinteistoverot/kive_201.px 2.1 Statistics on Real Estate Tax acc… en
#> 19 Vero/Kiinteistoverot/kive_202.px 2.2 Kiinteistöveroprosentin mukaiset … fi
#> 20 Vero/Kiinteistoverot/kive_202.px 2.2 Kalkylenliga fastighetsbeskattnin… sv
#> 21 Vero/Kiinteistoverot/kive_202.px 2.2 Statistics on Real Estate Tax acc… en
#> 22 Vero/Kiinteistoverot/kive_301.px 3.1 Rakennusten kiinteistöverot, jäll… fi
#> 23 Vero/Kiinteistoverot/kive_301.px 3.1 Byggnadernas fastighetsskatter, å… sv
#> 24 Vero/Kiinteistoverot/kive_301.px 3.1 Real estate taxes, replacement va… en
#> 25 Vero/Kiinteistoverot/kive_302.px 3.2 Maapohjien kiinteistöverot, verot… fi
#> 26 Vero/Kiinteistoverot/kive_302.px 3.2 Fastighetsskatter på, beskattning… sv
#> 27 Vero/Kiinteistoverot/kive_302.px 3.2 Real estate taxes on land, with t… en
#> 28 Vero/Kiinteistoverot/kive_400.px 4. Maankäyttölajitilasto muuttujina A… fi
#> 29 Vero/Kiinteistoverot/kive_400.px 4. Markanvändningsstatistik efter Omr… sv
#> 30 Vero/Kiinteistoverot/kive_400.px 4. Land use statistics by Area, Owner… en
#> # ℹ 1,647 more rows
Search and retrieval
The data()
function a conveniance function that works
for two tasks: search and retrieval.
- When the argument matches more than one table ids or titles, the
data()
function will return tibble of matched data tables. - When exactly one matching data table is found, the
data()
function will return that data table.
For example, data("väestö")
will search data and find
multible data tables, and return the matches. In contrast,
data("StatFin/synt/statfin_synt_pxt_12dx.px")
will return a
specific data table. The function data()
is meant for rapid
exploration, and in production context it is better use more specific
functions.
To separate the tasks of search and retrieval, use functions
data_search()
and data_get()
. Use
data_get()
to return a data table for a given table id, and
fail if no match exists. For example, use
data_get("StatFin/synt/statfin_synt_pxt_12dx.px")
to
guarantee that either a data table or an error will be returned.
The function data_search()
allows to search and return
matching table ids, without downloading actual data. For example, to
search all data tables related to “väestö”, use:
data_search("väestö")
#> ⠙ Requesting search
#> ⠹ Requesting search
#> ✔ Requesting search [2.2s]
#>
#> # Robonomist Database search results
#> id title lang
#> <r_id> <chr> <chr>
#> 1 StatFin/asas/statfin_asas_pxt_115a.px Asuntokunnat ja asuntoväestö muu… fi
#> 2 StatFin/asas/statfin_asas_pxt_115y.px Asuntokunnat ja asuntoväestö muu… fi
#> 3 StatFin/asas/statfin_asas_pxt_115z.px Asuntokunnat ja asuntoväestö muu… fi
#> 4 StatFin/asas/statfin_asas_pxt_116b.px Asuntokunnat ja asuntoväestö muu… fi
#> 5 StatFin/asas/statfin_asas_pxt_116e.px Asuntokunnat ja asuntoväestö muu… fi
#> 6 StatFin/eot/statfin_eot_pxt_11te.px Itse koettu terveys 16 vuotta tä… fi
#> 7 StatFin/eot/statfin_eot_pxt_11ty.px Tyytyväisyys elämään 16 vuotta t… fi
#> 8 StatFin/eot/statfin_eot_pxt_11ub.px Tyytyväisyys kotitalouden taloud… fi
#> 9 StatFin/eot/statfin_eot_pxt_11v2.px Tyytyväisyys elämään, keskiarvot… fi
#> 10 StatFin/eot/statfin_eot_pxt_11wp.px Onnellisuuden tunteet neljän vii… fi
#> 11 StatFin/eot/statfin_eot_pxt_11z9.px Yksinäisyyden tunne neljän viiko… fi
#> 12 StatFin/eot/statfin_eot_pxt_11zc.px Yksinäisyyden tunne neljän viiko… fi
#> 13 StatFin/eot/statfin_eot_pxt_11ze.px Tyytyväisyys elämään, keskiarvot… fi
#> 14 StatFin/eot/statfin_eot_pxt_11zy.px Itse koettu terveys 16 vuotta tä… fi
#> 15 StatFin/eot/statfin_eot_pxt_121a.px Tyytyväisyys elämään 16 vuotta t… fi
#> 16 StatFin/eot/statfin_eot_pxt_13ju.px Luottamus toisiin ihmisiin 16 vu… fi
#> 17 StatFin/eot/statfin_eot_pxt_13jv.px Luottamus toisiin ihmisiin 16 vu… fi
#> 18 StatFin/eot/statfin_eot_pxt_13wk.px Kotitalousväestön pienituloisuus… fi
#> 19 StatFin/eot/statfin_eot_pxt_13wl.px Kotitalousväestön pienituloisuus… fi
#> 20 StatFin/eot/statfin_eot_pxt_13wm.px Kotitalousväestön pienituloisuus… fi
#> 21 StatFin/eot/statfin_eot_pxt_13xi.px Toimintarajoitteiset henkilöt 16… fi
#> 22 StatFin/eot/statfin_eot_pxt_13xj.px Perustoiminnoissa koetut rajoitt… fi
#> 23 StatFin/eot/statfin_eot_pxt_13xl.px Kokemus ulkopuolisuuden tunteest… fi
#> 24 StatFin/eot/statfin_eot_pxt_13xt.px Tyytyväisyys ihmissuhteisiin 16 … fi
#> 25 StatFin/eot/statfin_eot_pxt_13xu.px Toimintarajoitteiset henkilöt 16… fi
#> 26 StatFin/eot/statfin_eot_pxt_13xv.px Itse koettu terveydentila 16 vuo… fi
#> 27 StatFin/eot/statfin_eot_pxt_13yc.px Kokemus ulkopuolisuuden tunteest… fi
#> 28 StatFin/eot/statfin_eot_pxt_14cm.px Luovien harrastusten harrastamin… fi
#> 29 StatFin/eot/statfin_eot_pxt_14cn.px Luovien harrastusten harrastamin… fi
#> 30 StatFin/eot/statfin_eot_pxt_14ct.px Elokuvissa, esityksissä, museois… fi
#> # ℹ 854 more rows
Tidy time and labels
For some datasources we are able to automatically parse the time
dimension of the data into a more convenient format. When the
tidy_time
argument is set to TRUE
, data tables
are formatted so that time dimension is named time
, the
class is set to Date
, and the variable is relocated next to
value
, i.e. second from the right.
data_get("StatFin/ntp/statfin_ntp_pxt_132h.px")
#> ⠙ Requesting get
#> ✔ Requesting get [220ms]
#>
#> # Robonomist id: StatFin/ntp/statfin_ntp_pxt_132h.px
#> # Title: Bruttokansantuote ja -tulo sekä tarjonta ja kysyntä
#> # neljännesvuosittain muuttujina Vuosineljännes, Taloustoimi ja Tiedot
#> # Last updated: 2024-06-19 13:00:00
#> # Next update: 2024-08-30 08:00:00
#> # A tibble: 109,326 × 4
#> Vuosineljännes Taloustoimi Tiedot value
#> * <chr> <chr> <chr> <dbl>
#> 1 1990Q1 B1GMH Bruttokansantuote markkinahintaan Kausitasoitettu… 22884
#> 2 1990Q1 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sa… 21610
#> 3 1990Q1 B1GMH Bruttokansantuote markkinahintaan Trendisarja käy… 22901
#> 4 1990Q1 B1GMH Bruttokansantuote markkinahintaan Työpäiväkorjatt… 21462
#> 5 1990Q1 B1GMH Bruttokansantuote markkinahintaan Kausitasoitettu… 35966
#> 6 1990Q1 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sa… 33876
#> 7 1990Q1 B1GMH Bruttokansantuote markkinahintaan Trendisarja, vi… 36013
#> 8 1990Q1 B1GMH Bruttokansantuote markkinahintaan Työpäiväkorjatt… 33950
#> 9 1990Q1 B1GMH Bruttokansantuote markkinahintaan Kausitasoitetun… NA
#> 10 1990Q1 B1GMH Bruttokansantuote markkinahintaan Trendisarjan vo… NA
#> # ℹ 109,316 more rows
data_get("StatFin/ntp/statfin_ntp_pxt_132h.px", tidy_time = TRUE) |>
arrange(Taloustoimi, Tiedot)
#> ⠙ Requesting get
#> ✔ Requesting get [216ms]
#>
#> # Robonomist id: StatFin/ntp/statfin_ntp_pxt_132h.px
#> # Title: Bruttokansantuote ja -tulo sekä tarjonta ja kysyntä
#> # neljännesvuosittain muuttujina Vuosineljännes, Taloustoimi ja Tiedot
#> # Last updated: 2024-06-19 13:00:00
#> # Next update: 2024-08-30 08:00:00
#> # A tibble: 109,326 × 4
#> Taloustoimi Tiedot time value
#> <chr> <chr> <date> <dbl>
#> 1 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sarja … 1990-01-01 21610
#> 2 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sarja … 1990-04-01 22885
#> 3 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sarja … 1990-07-01 22547
#> 4 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sarja … 1990-10-01 23917
#> 5 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sarja … 1991-01-01 20815
#> 6 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sarja … 1991-04-01 21921
#> 7 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sarja … 1991-07-01 21578
#> 8 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sarja … 1991-10-01 22585
#> 9 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sarja … 1992-01-01 20296
#> 10 B1GMH Bruttokansantuote markkinahintaan Alkuperäinen sarja … 1992-04-01 21301
#> # ℹ 109,316 more rows
Similarly, some datasources provide both labelled and coded versions of tha data tables:
data_get("StatFin/ntp/statfin_ntp_pxt_132h.px", labels = FALSE)
#> ⠙ Requesting get
#> ✔ Requesting get [208ms]
#>
#> # Robonomist id: StatFin/ntp/statfin_ntp_pxt_132h.px
#> # Title: Bruttokansantuote ja -tulo sekä tarjonta ja kysyntä
#> # neljännesvuosittain muuttujina Vuosineljännes, Taloustoimi ja Tiedot
#> # Last updated: 2024-06-19 13:00:00
#> # Next update: 2024-08-30 08:00:00
#> # A tibble: 109,326 × 4
#> Vuosineljännes Taloustoimi Tiedot value
#> * <chr> <chr> <chr> <dbl>
#> 1 1990Q1 B1GMH kausitcp 22884
#> 2 1990Q1 B1GMH tasmcp 21610
#> 3 1990Q1 B1GMH trendicp 22901
#> 4 1990Q1 B1GMH tyopcp 21462
#> 5 1990Q1 B1GMH kausitvv2015 35966
#> 6 1990Q1 B1GMH tasmvv2015 33876
#> 7 1990Q1 B1GMH trendivv2015 36013
#> 8 1990Q1 B1GMH tyopvv2015 33950
#> 9 1990Q1 B1GMH vol_kk_kausitvv2015 NA
#> 10 1990Q1 B1GMH vol_kk_trendivv2015 NA
#> # ℹ 109,316 more rows