This R package provides tools to access Parliament of Finland data from the unofficial Kansan Muisti 2.0 API. For API documentation, check here.
Installing the package (Installing the package)
Gender analysis (Estimating genders)
The following API endpoints are currently wrapped by finpar
:
| Data | API endpoint | Function |
|---------------------|------------------------------------|------------------------------------|
| Parliamentary terms | http://kansanmuisti.fi/api/v1/term | term()
|
| Members of the Parliament | http://kansanmuisti.fi/api/v1/member | member()
|
| Plenary sessions | http://kansanmuisti.fi/api/v1/plenary_session | plenary_session()
|
Install the development version:
library(devtools) install_github("ropengov/finpar")
Load the library:
library(finpar)
Set UTF-8 encoding:
Sys.setlocale(locale="UTF-8")
All terms of the Finnish parliament in 1907-2011
all_terms <- term() # Show the first ones in a table: library(knitr) kable(head(all_terms))
Get a specific term defined by ID
term_2011 <- term(id=1) print(term_2011)
Get all parliament members and plot their age distribution
all_members <- member() ages <- sapply(all_members, function (x) {x$age}) hist(ages, col = "gray", xlab = "Age", main = "Age distribution of parliament members", las = 1)
Get a specific member defined by ID:
jorn_donner <- member(id=30) # List available variables print(names(jorn_donner)) # Check age jorn_donner$age
Get all plenary sessions
all_plenary_sessions <- plenary_session()
Get a specific plenary session defined by ID
session <- plenary_session(id=30) # List available variables kable(session)
Use genderizeR to estimate gender for first names (note that there might be some inaccuracies in gender estimation for Finnish names):
# devtools::install_github("kalimu/genderizeR") suppressPackageStartupMessages(library(genderizeR)) x <- c("Sauli", "Tarja", "Mauno") givenNames <- findGivenNames(x, progress = FALSE) g <- genderize(x, genderDB=givenNames, blacklist=NULL, progress = FALSE) kable(g)
R code to calculate co-sponsorship networks from bills (and motions) passed in the Finnish Parliament by François briatte
R client for the unofficial API of Parliament of Finland provided by NGO Kansan Muisti. Parliament of Finland does not provide an official API, but Kansan Muisti does provide a RESTful API to a database mostly compiled by scraping data from parliament's web page. Great work !
This work can be freely used, modified and distributed under the MIT license.
citation("finpar")
This vignette was created with
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.