Learn R Programming

twfy

This package wraps TheyWorkForYou's API for R. TheyWorkForYou is a parliamentary monitoring site that scrapes and repackages Hansard (the UK's parliamentary record) and augments it with information from the Register of Members' Interests, election results, and voting records to provide a unified source of information about UK legislators and their activities.

Set up

You'll need an API key to. Get it here.

Your first API call (or call to set_api_key) will prompt you to paste it into the R console, after which it will be available for all future R sessions.

Installation

Install twfy using devtools:

devtools::install_github("conjugateprior/twfy")

If this does not work

install.packages("devtools")

and try again.

Results

In general, API call results are returned as json, then parsed into nested data.frames and lists using jsonlite. One exception is getBoundary which returns a string of KML.

Documentation

Package documentation is incomplete. A more nearly complete set of documentation can be found from the API source.

Copy Link

Version

Install

install.packages('twfy')

Monthly Downloads

121

Version

0.1.0

License

GPL-3

Maintainer

Will Lowe

Last Published

June 26th, 2017

Functions in twfy (0.1.0)

getConstituency

Get information for a constituency
getDebates

Get information about parliamentary debates
getCommittee

Get members of a Parliamentary Select Committee
getConstituencies

Get constituency names
getGeometry

Return geometry information for a constituency
getHansard

Search Hansard
call_api

Call the API directly
convertURL

Convert URL
getBoundary

Get constituency boundary information as KML
getComments

Get comments left on TheyWorkForYou
getMSP

Get information on a Member of the Scottish Parliament
getMSPs

Get information about Members of the Scottish Parliament
getPerson

Get information about a person
getWMS

Get written ministerial responses
getMP

Get information about a Member of Parliament
getMPInfo

Get more information about a Member of Parliament
getWrans

Get written answers to questions
get_api_key

Get the API key
getLord

Get information about a Lord
getLords

Get information about Lords
set_api_key

Set the API key
twfy

twfy: A package for accessing TheyWorkForYou
getMPs

Get information about Members of Parliament
getMPsInfo

Get more information about a Member of Parliament
getMLA

Get information on a Member of the Legislative Assembly (Northern Ireland)
getMLAs

Get information on Members of the Legislative Assembly (Northern Ireland)