/SCBHandlerPlotter

A library for handling statistical tables from SCB, and creating interactive map plots based on them

Primary LanguageRGNU General Public License v3.0GPL-3.0

Codecov test coverage Build Status

SCBHandlerPlotter

An R library for handling statistical tables from SCB, and creating interactive map plots based on them.

Data from Statistics Sweden (SCB) of course comes in various tables. This repository contains code to provide a single unified function call for fetching data from a collection of these tables. So, for example, to learn how many divorced 24-year-old women there were in Uppsala municipality in 2019, one can run

SCB(Municipality = "Uppsala", Age=24, Gender="Women", MaritalStatus = "Divorced")

and to learn how large an area of forest there is in Lomma municipality, one runs

SCB(Municipality = "Lomma", LandUseType = "Total forest")

despite these data points being in different tables.

Additionally, it provides code for creating interactive map plots of data on Swedish municipalities, using the ggiraph package. Try running

girafe(ggobj = exampleForestPlot())

to see this in action.

Setup

The library can be installed using

devtools::install_github("vagdur/SCBHandlerPlotter", ref = "1.0.0")

for the latest stable version, or omit the "ref" part for the current state on GitHub (I offer no guarantees that that state is desirable).

Data sources

All tables except one are from SCB, one is from Skolverket. The map of Sweden is from SCB, via the package swemaps.