MyNixOS website logo
Description

Sotkanet Open Data Access and Analysis.

Access statistical information on welfare and health in Finland from the Sotkanet open data portal <https://sotkanet.fi/sotkanet/fi/index>.

sotkanet: Tools for accessing open data on welfare and health in Finland

rOG-badge R buildstatus CRAN_Status_Badge r-universe Downloadstotal Downloadsmonthly Watch onGitHub Star onGitHub [Follow onTwitter] Codecov testcoverage

R package to access and manipulate data from the Sotkanet demographics indicator database. The Sotkanet data portal provides over 2000 demographic indicators across Finland and Europe, and is maintained by the National Institute for Health and Welfare (THL). For more information, see data description.

Installation

You can install the stable release version from CRAN:

install.packages("sotkanet")

Alternatively, you can install the development version of sotkanet package from GitHub with:

# install.packages("remotes")
remotes::install_github("rOpenGov/sotkanet")

Development version can be also installed using the r-universe:

# Enable this universe
options(repos = c(
  ropengov = "https://ropengov.r-universe.dev",
  CRAN = "https://cloud.r-project.org"
))
install.packages("sotkanet")

Using the package

Load the package in R:

library(sotkanet)

List available indicators in the Sotkanet data portal:

# Pre-defined list of indicators to save bandwidth
sotkanet.indicators <- sotkanet_indicators(c(4,5,6,7,46,74))
head(sotkanet.indicators$indicator.title)
#> [1] "Mielenterveyden häiriöihin sairaalahoitoa saaneet 0 - 17-vuotiaat / 1 000 vastaavan ikäistä"             
#> [2] "Toimeentulotukea saaneet 25 - 64-vuotiaat, % vastaavan ikäisestä väestöstä"                              
#> [3] "Somaattisen erikoissairaanhoidon vuodeosastohoitopäivät 75 vuotta täyttäneillä / 1 000 vastaavan ikäistä"
#> [4] "0 - 6-vuotiaat, % väestöstä"                                                                             
#> [5] "0 - 6-vuotiaat, % väestöstä, väestöennuste 2060"                                                         
#> [6] "Yhden vanhemman perheet, % lapsiperheistä"

Here is an example of data retrieval and visualization, using indicator describing private dental care use among 0-17 years old in 2015-2022.

library(ggplot2)
library(ggrepel)

hammashoito <- get_sotkanet(indicators = 1075, years = 2015:2022, genders = "total", region.category = "MAAKUNTA")

# Indicator title tells what this indicator is about
unique(hammashoito$indicator.title)
#> [1] "Yksityisen hammashuollon käynnit 0 - 17-vuotiailla / 1 000 vastaavan ikäistä"


# Some data has to be retrieved separately
hammashoito_metadata <- sotkanet_indicator_metadata(id = 1075)

plot_caption <- paste0("Lähde: https://sotkanet.fi / ", hammashoito_metadata$organization$title, "\n",
                       "Datan päiväys ", hammashoito_metadata$`data-updated`)

plot <- ggplot(hammashoito, aes(x=year, y=primary.value, group=region.title))+
  geom_line(aes(color=region.title)) +
  geom_point(aes(color=region.title))

plot + labs(title = "Yksityisen hammashuollon käynnit 2015-2022",
            subtitle = "0 - 17-vuotiailla / 1 000 vastaavanikäistä",
            x = "Vuosi", 
            y = "Käyntien lkm",
            caption = plot_caption,
            color = "Maakunta") +
  geom_text_repel(
    aes(color = region.title, label = ifelse(year == 2022, region.title, NA_character_)),
    xlim = c(2023, 2025),
    direction = "both",
    hjust = 0,
    segment.size = .7,
    segment.alpha = .5,
    segment.linetype = "dotted",
    box.padding = .4,
    segment.curvature = -0.1,
    segment.ncp = 3,
    segment.angle = 20,
    size = 3)+
  theme(legend.position = "none",
        panel.background = element_rect(fill = "linen")) +
  scale_x_continuous(
    expand = c(0, 0),
    limits = c(2015, 2025), 
    breaks = seq(2015, 2022))

For more in-depth examples, see the package vignette or online tutorial page.

Contributing

Acknowledgements

Kindly cite this work as follows: Leo Lahti, Einari Happonen, Juuso Parkkinen, Joona Lehtomaki, Vesa Saaristo, Aleksi Lahtinen and Pyry Kantanen (rOpenGov 2024). sotkanet: Sotkanet Open Data Access and Analysis. R package version 0.9.80. URL: https://github.com/rOpenGov/sotkanet

We are grateful to all contributors, and for the Sotkanet Statistics and Indicator Bank! This project is part of rOpenGov.

Disclaimer

This package is in no way officially related to or endorsed by The Finnish Institute for Health and Welfare (Terveyden ja hyvinvoinnin laitos, THL).

For information about THL’s open data license and limitation of liability, please see their website:

Metadata

Version

0.10.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows