Learn R Programming

ManifestoR

An R package for accessing and processing the Manifesto Project's Data and Corpus of election programmes.

Description

Provides access to coded election programmes from the Manifesto Corpus and to the Manifesto Project's Main Dataset and routines to analyse this data. The Manifesto Project https://manifesto-project.wzb.eu collects and analyses election programmes across time and space to measure the political preferences of parties. The Manifesto Corpus contains the collected and annotated election programmes in the Corpus format of the package 'tm' to enable easy use of text processing and text mining functionality. Specific functions for scaling of coded political texts are included. See https://manifesto-project.wzb.eu for additional tutorials, documentation, data, and election programmes.

Quick Start Guide

You can install the package from CRAN:

install.packages("manifestoR")

Then a typical script or session with manifestoR starts like this:

library(manifestoR)
mp_setapikey("manifesto_apikey.txt") ## create and download your API key at https://manifesto-project.wzb.eu before

## download election programmes texts and codings
election_programmes <- mp_corpus(countryname == "Bulgaria")

## for example:
head(content(election_programmes[[1]])) ## view beginning of text of first manifesto
table(codes(election_programmes)) ## count codes of all manifestos

## ...

Documentation

The main user documentation is the vignette manifestoRworkflow. It walks you through the package's central functions giving many example code bits. For detailed information about all functions and parameters, pleaser refer to the functions' documentations with R's ? or the packages Reference Manual.

Contributing

If you want to contribute to the development of manifestoR by reporting bugs, proposing features or writing program code, you are invited to do this on the package's github page: https://github.com/ManifestoProject/manifestoR. Developers, please also note the information on packing and testing manifestoR below.

Alternative versions and installation methods

Stable major versions of manifestoR will be provided on CRAN, such that you can install and update them via R's base functions install.packages and update.packages. A development version is available on github, which you can install to get the most recent features and bugfixes.

Installation from github

Note that the NAMESPACE file and documentation are not part of the github repository, since they are generated automatically. Hence installation with devtools via install_github is not possible. Instead, you can clone the master branch of the repository and a Makefile will come with the source code. make install packs and installs the package (and documentation) to your default R installation, requiring devtools to be installed.

Developing: from a local source copy

The Makefile in the github repository contains several other targets helpful for developing:

make (=make all) packs the package (and documentation) to a tarball in the parent directory.

You can run the tests provided together with the source code with make test. Note that this requires a file with a valid Manifesto Project DB API Key in the file tests/manifesto_apikey.txt.

make check checks the package.

Build dependencies:

To pack the source and documentation from this folder into a package tarball your system needs to have installed:

  • R packages devtools and roxygen2
  • R packages knitr (for documentation)
  • texlive-fonts-extra (for documentation)

Copy Link

Version

Install

install.packages('manifestoR')

Monthly Downloads

862

Version

1.5.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

November 29th, 2020

Functions in manifestoR (1.5.0)

ManifestoCorpus

Manifesto Corpus class
aggregate_pers

Aggregate category percentages in groups
aggregate_pers_cee

Aggregate cee-categories to main categories
clarity_dimensions

Default programmatic clarity dimensions from Giebler/Lacewell/Regel/Werner 2015.
attach_year

Compute year from date variable in MPDS
v4_categories

Lists of categories and category relations
ManifestoAvailability

Manifesto Availability Information class
ManifestoDocument

Manifesto Document
ManifestoSource

Data Source for Manifesto Corpus
ManifestoDocumentMeta

Manifesto Document Metadata
get_viacache

Get API results via cache
manifestoR

Access and process data and documents of the Manifesto Project
iff

Apply a function if and only if test is TRUE
issue_attention_diversity

Issue Attention Diversity
franzmann_kaiser

Left-Right Scores based on Franzmann & Kaiser Method
count_codes

Count the codings from a ManifestoDocument
mp_codebook

Access to the Codebook for the Manifesto Project Main Dataset
mp_corpusversions

List the available versions of the Manifesto Project's Corpus
mp_clarity

Programmatic clarity measures (PC)
mp_check_for_corpus_update

Check for Updates of Corpus in Manifesto Project DB
readManifesto

formatmpds

Format the main data set
mp_dedication

Print manifestoR package dedication
formatids

Format ids for web API queries
mp_scale

Scaling annotated manifesto documents
mp_setapikey

Set the API key for the Manifesto Documents Database.
mp_emptycache

Empty the manifestoR's cache
mp_cite

Print Manifesto Corpus citation information
get_mpdb

Download content from the Manifesto Database
mp_bootstrap

Compute bootstrap distributions for scaling functions
recode_cee_codes

Process CMP codings
mp_corpus

Get documents from the Manifesto Corpus Database
mp_coreversions

List the available versions of the Manifesto Project's Main Dataset
codes

Access the codes of a Manifesto Document or Corpus
mp_availability

Availability information for election programmes
median_voter

Median Voter position
mp_rmps

Relative measure of party size (RMPS)
mp_nicheness

Party nicheness measures
mp_metadata

Get meta data for election programmes
null_to_na

Convert NULL to NA
mp_save_cache

Save manifestoR's cache
prefix

Prefix a string of text
vanilla

Vanilla Scaling by Gabel & Huber
mpdb_api_request

Manifesto Project DB API request
na_replace

Replace NAs in vector with fixed value
mp_interpolate

Interpolate values within election periods
scale_weighted

Scaling functions
rep.data.frame

Replicates cases in a data.frame
split_belgium

Split Belgium party system into separate groups
mp_load_cache

Load manifestoR's cache
mp_use_corpus_version

Use a specific version of the Manifesto Project Corpus
mp_maindataset

Access the Manifesto Project's Main Dataset
mp_view_originals

View original documents from the Manifesto Corpus Database
rile

RILE
rescale

Simple linear rescaling of positions