This R package provides tools to access open data from Statistics Finland, including about 3000 data sets from Statistics Finland. Part of rOpenGov.
Geospatial data of Statistics Finland is available via the gisfin package.
Tools for the new [PX-Web API] of Statistics Finland are available via the pxweb package.
Release version for general use:
install.packages("statfi") library(statfi)
Development version (potentially unstable):
install.packages("devtools") library(devtools) install_github("statfi", "ropengov") library(statfi)
The listings of Statistics Finland (StatFi) open data are available for browsing in PCAxis, CSV and XML format. These include the following data collections:
In summary, browse these listings to find the URL for your data set of interest. Then use the get_statfi function to download the data in R. For examples, see below.
Download statfi open data listings in R as follows:
# Load the library library(statfi) # Statistics Finland open data listing datasets.statfi <- list_statfi_files() # Descriptions of the first entries head(datasets.statfi$DESCRIPTION) # Investigate the first entry in StatFi data print(datasets.statfi[1,])
This provides the list of statfi data sets. For other international open statistics available via Statfi, browse the data sets manually to find the URL for your dataset of interest. For Eurostat data, we recommend the eurostat R package.
Retrieve data from Statfi by defining URL of the data set. For the listing of available data sets and their corresponding URLs, see above.
library(statfi) # Define URL (see list_statfi_files() or browse manually as described above) url <- "http://pxweb2.stat.fi/Database/StatFin/tul/tvt/2009/120_tvt_2009_2011-02-18_tau_112_fi.px" # Download the data df <- get_statfi(url) df[1:3,]
Source: Tilastokeskus
# Download Statfi municipality data municipality.info.statfi <- get_municipality_info_statfi() # List available information fields for municipalities names(municipality.info.statfi)
Regarding the data, kindly cite Statfi. We are grateful to Statistics Finland open data personnell for their support during the R package development.
This work can be freely used, modified and distributed under the Two-clause FreeBSD license. Kindly cite the R package as 'Leo Lahti, Juuso Parkkinen ja Joona Lehtomäki (C) 2010-2014. statfi R package. URL: http://ropengov.github.io/statfi'.
This tutorial was created with
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.