Learn R Programming

pvsR (version 0.3)

getAllDistricts: Get basic data on all districts

Description

This function is essentially a wrapper around District.getByOfficeState().

Usage

getAllDistricts()

Arguments

Value

  • A data frame with a row for each district and columns with the following variables describing the district: districtList.district*.districtId, districtList.district*.name, districtList.district*.officeId, districtList.district*.stateId.

References

http://api.votesmart.org/docs/District.html See http://api.votesmart.org/docs/semi-static.html for a list of office IDs or use Office.getOfficesByType(), Office.getOfficesByLevel(), Office.getOfficesByTypeLevel() or Office.getOfficesByBranchLevel(). Use State.getStateIDs() to get a list of state IDs.

Examples

Run this code
# First, make sure your personal PVS API key is saved as character string in the pvs.key variable:
pvs.key <- "yourkey"
# get a list of all districts
districts <- getAllDistricts()
head(districts)

Run the code above in your browser using DataLab