Npat.getNpat: Get a candidate's most recently filled out NPAT/PCT...

Description Usage Arguments Value Author(s) References Examples

Description

This function is a wrapper for the Npat.getNpat() method of the PVS API Npat class which returns the candidate's most recently filled out NPAT/PCT. The function sends a request with this method to the PVS API for all candidate IDs given as a function input, extracts the XML values from the returned XML file(s) and returns them arranged in one data frame.

Usage

1
Npat.getNpat(candidateId)

Arguments

candidateId

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

Value

A data frame with a row for each candidate and columns with the following variables describing the candidate:
bio.candidate.crpId (OpenSecrets ID),
bio.candidate.firstName,
bio.candidate.nickName,
bio.candidate.middleName,
bio.candidate.lastName,
bio.candidate.suffix,
bio.candidate.birthDate,
bio.candidate.birthPlace,
bio.candidate.pronunciation,
bio.candidate.gender,
bio.candidate.family,
bio.candidate.photo,
bio.candidate.homeCity,
bio.candidate.homeState,
bio.candidate.education,
bio.candidate.profession,
bio.candidate.political,
bio.candidate.religion,
bio.candidate.congMembership,
bio.candidate.orgMembership,
bio.candidate.specialMsg,
bio.office.parties,
bio.office.title,
bio.office.shortTitle,
bio.office.name,
bio.office.type,
bio.office.status,
bio.office.firstElect,
bio.office.lastElect,
bio.office.nextElect,
bio.office.termStart,
bio.office.termEnd,
bio.office.district,
bio.office.districtId,
bio.office.stateId,
bio.office.committee*.committeeId,
bio.office.committee*.committeeName,
bio.election*.office,
bio.election*.officeId,
bio.election*.officeType,
bio.election*.parties,
bio.election*.district,
bio.election*.districtId,
bio.election*.status,
bio.election*.ballotName.

Author(s)

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

References

http://api.votesmart.org/docs/CandidateBio.html
Use Candidates.getByOfficeState(), Candidates.getByOfficeTypeState(), Candidates.getByLastname(), Candidates.getByLevenshtein(), Candidates.getByElection(), Candidates.getByDistrict() or Candidates.getByZip() to get a list of candidate IDs.

Examples

1
2
3
4
5
6
# First, make sure your personal PVS API key is saved as character string in the pvs.key variable:
## Not run: pvs.key <- "yourkey"
# get political courage tests of Barack Obama and John Sidney McCain III
## Not run: pcts <- Npat.getNpat(list(9490,53270))
## Not run: head(pcts$survey)
## Not run: head(pcts$candidate)

Example output



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

Related to Npat.getNpat in pvsR...