get_rep_by_division: get_rep_by_division

Description Usage Arguments Value Examples

View source: R/get_rep_by_division.R

Description

This function interacts with the representatives endpoint of the Google Civic Information API

Usage

1
2
3
4
5
6
7
get_rep_by_division(
  ocdId = NULL,
  levels = NULL,
  recursive = NULL,
  roles = NULL,
  key = Sys.getenv("google_civic_api")
)

Arguments

ocdId

An Open Civic Data Division Identifier, e.g. from the id column of ocd_divisions

levels

List of office levels supplied as string. Only offices that serve at least one of these levels will be returned Acceptable values are: "administrativeArea1", "administrativeArea2", "country", "international", "locality", "regional", "special", "subLocality1", "subLocality2"

recursive

If TRUE, information about all divisions contained in the division requested will be included as well. For example, if querying ocd-division/country:us/district:dc, this would also return all DC's wards and ANCs.

roles

List of roles supplied as string. Only offices fulfilling one of these roles will be returned. Acceptable values are: "deputyHeadOfGovernment", "executiveCouncil", "governmentOfficer", "headOfGovernment", "headOfState", "highestCourtJudge", "judge", "legislatorLowerBody", "legislatorUpperBody", "schoolBoard", "specialPurposeOfficer"

key

API key supplied as a string. Defaults to the environmental variable called "google_civic_api." Info on how to get a key can be found here: https://developers.google.com/civic-information

Value

Returns a list of offices by divisions and respective officials

Examples

1
2
3
4
5
6
7
8
## Not run: 
get_rep_by_division(
    ocdId = "ocd-division/country:us/district:dc",
    level="locality",
    recursive = TRUE
)

## End(Not run)

willdebras/googlecivic documentation built on Feb. 15, 2021, 6:58 p.m.