Package 'elexr'

Title: Simple wrapper around the elex tool
Description: Wraps the elex tool to provide R access to Associated Press election results
Authors: Geoff Hing
Maintainer: Geoff Hing <[email protected]>
License: MIT
Version: 1.0
Built: 2024-09-06 03:51:23 UTC
Source: https://github.com/ghing/elexr

Help Index


Simple wrapper around the elex tool

Description

Wraps the elex tool to provide R access to Associated Press election results

Details

A light R wrapper around the elex command

elexr provides an R interface for the elex package (http://github.com/newsdev/elex/) to load election results from the Associated Press Elections API.

Rather than reinventing the wheel, this package simply runs elex in a shell and loads the CSV output into a data frame. Because of this, you'll need Python and to install elex by following the instructions at http://elex.readthedocs.org/en/latest/install.html.

You'll also need an API key for the API Elections API. You'll need to set the AP_API_KEY environtment variable in your R session to be able to retreive results.

Examples

library(elexr)
Sys.setenv(AP_API_KEY = "YOUR_AP_ELECTIONS_API_KEY")
iowa_caucus_results <- results('03-01-2016')

Fetch election results

Description

Fetch election results

Usage

results(election_date)

Arguments

election_date

Election date as a string in MM-DD-YYYY format.