candidates_get_by_office_state {votesmart}R Documentation

Get candidates by the state in which they hold office

Description

Get candidates by the state in which they hold office

Usage

candidates_get_by_office_state(
  state_ids = NA,
  office_ids,
  election_years = lubridate::year(lubridate::today()),
  all = TRUE,
  verbose = TRUE
)

Arguments

state_ids

Optional: vector of state abbreviations. Default is NA, for national-level offices (e.g. US President and Vice President). For all other offices the state_id must be supplied.

office_ids

Required: vector of office ids that candidates hold. See office_get_levels and office_get_offices_by_level for office ids.

election_years

Optional: vector of election years in which the candidate held office. Default is the current year.

all

Boolean: should all possible combinations of the variables be searched for, or just the exact combination of them in the order they are supplied?

verbose

Should cases when no data is available be messaged?

Value

A dataframe of candidates and their attributes. If a given state_id + office_id + election_year combination returns no data, that row will be filled with NAs.

Examples

## Not run: 
candidates_get_by_office_state(
  state_ids = c(NA, "NY", "CA"),
  office_ids = c("1", "6"),
  verbose = TRUE
)

## End(Not run)

[Package votesmart version 0.1.2 Index]