getAllVotes: Get several votes

Description Usage Arguments Details Value Author(s) References Examples

Description

This function is essentially a wrapper around Votes.getBillActionVotes() specified for large amount of requests.

Usage

1
getAllVotes(actionId, batchsize=100, pause=0, backupfile="votes.list.Rdata")

Arguments

actionId

a character string or list of character strings with the action ID(s) (see references for details)

batchsize

numerical, indicating how many actionIds should be processed in one batch (defaults to 100).

pause

numerical, indicating how long (in seconds) the download process should be paused after each batch (defaults to 0)

backupfile

character string for the path/file-name of the Rdata-file where the data should be saved (batch-wise) during the download process (default: "votes.list.Rdata").

Details

This functions splits large requests into several batches. The requests are then processed batch-wise and are saved on the local disc to make sure that not too much RAM is assigned to the pvsR task.

Value

A data frame with a row for each vote and columns with the following variables describing the vote:
votes.vote*.candidateId,
votes.vote*.candidateName,
votes.vote*.officeParties,
votes.vote*.action.

Author(s)

Ulrich Matter <ulrich.matter-at-unibas.ch>

References

http://api.votesmart.org/docs/Votes.html
Use Votes.getBill() or Votes.getByOfficial() to get a list of action IDs.

Examples

1
2
3
4
5
6
7
8
# First, make sure your personal PVS API key is saved as character string in the pvs.key variable:
## Not run: pvs.key <- "yourkey"
# get all officials of a certain state
## Not run: bill <- Votes.getBill("17623", separate=c("actions", "sponsors"))
## Not run: actionids <- bill$actions$actionId
# get all votes on this acti
## Not run: votes <- getAllVotes(actionids, batchsize=2)
## Not run: head(votes)

Example output



pvsR documentation built on May 2, 2019, 5:16 a.m.

Related to getAllVotes in pvsR...