Learn R Programming

rsunlight (version 0.7.0)

os_legislatorsearch: Search Legislators on OpenStates.

Description

Search Legislators on OpenStates.

Usage

os_legislatorsearch(state = NULL, first_name = NULL, last_name = NULL,
  chamber = NULL, active = NULL, term = NULL, district = NULL,
  party = NULL, fields = NULL, as = "table", key = NULL, ...)

Arguments

state

state two-letter abbreviation (character)

first_name

first name of legislator (character)

last_name

last name of legislator (character)

chamber

one of 'upper' or 'lower' (character)

active

TRUE or FALSE (character)

term

filter by legislators who served during a certain term (character)

district

legislative district (character)

party

democratic or republican (character)

fields

You can request specific fields by supplying a vector of fields names. Many fields are not returned unless requested. If you don't supply a fields parameter, you will get the most commonly used subset of fields only. To save on bandwidth, parsing time, and confusion, it's recommended to always specify which fields you will be using.

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

List of output fields.

Examples

Run this code
# NOT RUN {
os_legislatorsearch(state = 'ca', party = 'democratic')
os_legislatorsearch(state = 'tx', party = 'democratic', active = TRUE)
os_legislatorsearch(state = 'nv', party = 'republican')
os_legislatorsearch(state = 'dc', chamber = 'upper')

# pass in more than one value for some parameters
os_legislatorsearch(state = c('dc', 'or'), chamber = 'upper')
os_legislatorsearch(first_name = c('jane', 'bob'), chamber = 'upper')
# }

Run the code above in your browser using DataLab