Skip to content

Compiling government positions from the Manifesto Project data with R

Last updated on January 30, 2019

****N.B. I have updated the functions in February 2019 to makes use of the latest Manifesto data. See for details here.***

The Manifesto Project (former Manifesto Research Group, Comparative Manifestos Project) has assembled a database of ‘quantitative content analyses of parties’ election programs from more than 50 countries covering all free, democratic elections since 1945’ and is freely accessible online. The data, however, is available only at the party, and not at the government (cabinet) level. In order to automate  the process of extracting government positions from the Manifesto data, I wrote a simple R function which combines the party-level Manifesto data with the data on government compositions from the ParlGov database. The function manifesto.position() produces a data frame with the country, the time period, the government position of interest, and an index (id) variable. You can get the data either at a monthly or yearly period of aggregation, specify the start and the end dates, and get the data in ‘long’ or ‘wide’ format.

Here is how it works: First, you would need R up and running (with the ‘ggplot2‘ library installed). Second, you need the original data on party positions and on government compositions, and this script to merge them. Alternatively, you can download (or source) directly the resulting merged dataset here. Third, you need to source the file containing the functions.

Here are a few examples of the function in action:

####
### 1. Load the data file from the working directory or from the URL (default)
#cabinets<-read.table ('cabinets.txt', as.is=TRUE)
cabinets<-read.table ('http://www.dimiter.eu/Data_files/cabinets/cabinets.txt', as.is=TRUE) ### 2. Load the functions from the working directory or from the URL (default) #source('government position extraction functions.R') source('http://www.dimiter.eu/Data_files/cabinets/government%20position%20extraction%20functions.R') ### Use of manifesto.position(x, weighted=TRUE, long=TRUE, period='year', start=1945, end=2010) ### Inputs: ### x [the name of the Manifesto item] ### weighted [weighted mean of the government position or a simple unweighted mean] ### period [year (default) or month - time period for which the position is extracted] ### long [long (default) or wide version of the output data] ### start [starting year for the extraction; 1945 is default] ### end [end year of the extraction; 2010 is default] ### Output: A data frame with four columns - State, Year (Year.month), position [the actual position], id [Year.State(Year.month.State)] ### For details see the sourced file above ### Examples ## 1. Extract the left/right positions lr<-manifesto.position('rile') summary(lr) ## 2. Exatract the unweighted International peace position from 1980 until 1999 intp<-manifesto.position('intpeace', weighted=F, start=1980, end=1999) hist(intp$position) ## 3. Exatract the weighted Welfare position from 1980 until 1999 in a wide, rather than long shape - states are rows and years are colunms welfare<-manifesto.position('welfare', long=F, start=1980, end=1999) welfareT<-t(welfare) ##this would make the countries columns and the years rows. ## 4. Left/right on a monthly basis from 1980 till 1990 lrm<-manifesto.position('rile', period='month', start=1980, end=1990)

I hope you find the function useful. Feel free to e-mail any suggestions, remarks, reports on bugs, etc. If you use the function and the data, don’t forget to acknowledge the work of the people who collected the Manifestos and who compiled the ParlGov database.

Published inPolicy makingR

One Comment

Leave a Reply

Your email address will not be published.