Learn R Programming

rsunlight (version 0.7.0)

os_districts: Search OpenStates districts

Description

Search OpenStates districts

Usage

os_districts(state, chamber = NULL, abbr = NULL, boundary_id = NULL,
  id = NULL, legislators = NULL, name = NULL, num_seats = NULL,
  as = "table", key = NULL, ...)

Arguments

state

state two-letter abbreviation (character). required

chamber

Whether this district belongs to the upper or lower chamber. (character)

abbr

State abbreviation. (character)

boundary_id

boundary_id used in District Boundary Lookup (character)

id

A unique ID for this district (separate from boundary_id).

legislators

List of legislators that serve in this district. (may be more than one if num_seats > 1)

name

Name of the district (e.g. '14', '33A', 'Fifth Suffolk')

num_seats

Number of legislators that are elected to this seat. Generally one, but will be 2 or more if the seat is a multi-member district.

as

(character) One of table (default), list, or response (crul response object)

key

your SunlightLabs API key; loads from .Rprofile

...

Curl options passed on to crul::HttpClient

Value

a data.frame of bills.

Details

this route appears to not support pagination, sorting or selecting fields

Examples

Run this code
# NOT RUN {
os_districts(state = 'tx')
os_districts(state = 'tx', chamber = 'upper')
os_districts(state = 'dc')
os_districts(state = 'dc', per_page=3)
os_districts(state = 'dc', per_page=3, sort='created_at')
# }

Run the code above in your browser using DataLab