Package 'congress'

Title: Access the Congress.gov API
Description: Download and read data on United States congressional proceedings. Data is read from the Library of Congress's Congress.gov Application Programming Interface (<https://github.com/LibraryOfCongress/api.congress.gov/>). Functions exist for all version 3 endpoints, including for bills, amendments, congresses, summaries, members, reports, communications, nominations, and treaties.
Authors: Christopher T. Kenny [aut, cre]
Maintainer: Christopher T. Kenny <[email protected]>
License: MIT + file LICENSE
Version: 0.0.4
Built: 2024-10-06 05:04:46 UTC
Source: https://github.com/christopherkenny/congress

Help Index


Request Amendment Information

Description

Request Amendment Information

Usage

cong_amendment(
  congress = NULL,
  type = NULL,
  number = NULL,
  item = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

type

Type of amendment. Can be 'hamdt', 'samdt', or '⁠suamdt'⁠.

number

Amendment assigned number. Numeric.

item

Information to request. Can be 'actions', 'amendments', or 'cosponsors'. 'text' is available when congress >= 117.

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE.

Examples

# Requires API Key

cong_amendment()

cong_amendment(congress = 117)

cong_amendment(congress = 117, type = 'samdt', number = 2137)

cong_amendment(congress = 117, type = 'samdt', number = 2137, item = 'actions')

Request Bill Information

Description

Request Bill Information

Usage

cong_bill(
  congress = NULL,
  type = NULL,
  number = NULL,
  item = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

type

Type of bill. Can be 'hr', 's', 'hjres', 'sjres', 'hconres', 'sconres', 'hres', or 'sres'.

number

Bill assigned number. Numeric.

item

Information to request. Can be 'actions', 'amendments', 'committees', 'cosponsors', 'relatedbills', 'subjects', 'text', or 'titles'

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_bill()

cong_bill(congress = 117)

cong_bill(congress = 117, type = 'hr', number = 3076)

cong_bill(congress = 117, type = 'hr', number = 3076, item = 'actions')

Request bound Congressional Record Information

Description

Request bound Congressional Record Information

Usage

cong_bound_record(
  year = NULL,
  month = NULL,
  day = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

year

integer for year

month

integer for month

day

integer for day of month

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_bound_record()

cong_bound_record(year = 1990)

cong_bound_record(year = 1990, month = 5)

cong_bound_record(year = 1948, month = 5, day = 19)

Request Committee Information

Description

Request Committee Information

Usage

cong_committee(
  congress = NULL,
  chamber = NULL,
  committee = NULL,
  item = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

chamber

Chamber name. Can be 'house', 'senate', or 'joint'.

committee

Code identifying committee. Character.

item

Information to request. Can be 'bills', 'reports', 'nominations', 'house-communication', or 'senate-communication'.

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_committee()

cong_committee(congress = 117)

cong_committee(chamber = 'house')

cong_committee(congress = 117, chamber = 'house')

cong_committee(chamber = 'house', committee = 'hsed10')

cong_committee(chamber = 'house', committee = 'hspw00', item = 'house-communication')

cong_committee(chamber = 'senate', committee = 'jsec03')

cong_committee(chamber = 'senate', committee = 'slpo00', item = 'bills')

cong_committee(chamber = 'senate', committee = 'slpo00', item = 'senate-communication')

Request Committee Meeting Information

Description

Request Committee Meeting Information

Usage

cong_committee_meeting(
  congress = NULL,
  chamber = NULL,
  number = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

chamber

Chamber name. Can be 'house', 'senate', or 'nochamber'.

number

Meeting event identifier. Character (or numeric).

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_committee_meeting()

cong_committee_meeting(congress = 118)

cong_committee_meeting(chamber = 'house')

cong_committee_meeting(congress = 118, chamber = 'house')

cong_committee_meeting(congress = 118, chamber = 'house', number = '115538')

Request Committee Print Information

Description

Request Committee Print Information

Usage

cong_committee_print(
  congress = NULL,
  chamber = NULL,
  number = NULL,
  item = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

chamber

Chamber name. Can be 'house', 'senate', or 'nochamber'.

number

Jacket number for the print. Character (or numeric).

item

Information to request. Can be 'text'.

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_committee_print()

cong_committee_print(congress = 118)

cong_committee_print(chamber = 'house')

cong_committee_print(congress = 118, chamber = 'house')

cong_committee_print(congress = 117, chamber = 'house', number = '48144')

cong_committee_print(congress = 117, chamber = 'house', number = '48144', item = 'text')

Request Committee Report Information

Description

Request Committee Report Information

Usage

cong_committee_report(
  congress = NULL,
  type = NULL,
  number = NULL,
  item = NULL,
  conference = FALSE,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

type

Type of committee report. Can be 'hrpt', 'srpt', or 'erpt'.

number

Committee report assigned number. Numeric.

item

Information to request. Can be 'text'.

conference

Filter to conference reports. Default is FALSE.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble if clean = TRUE or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_committee_report()

cong_committee_report(conference = TRUE)

cong_committee_report(congress = 116)

cong_committee_report(congress = 116, type = 'hrpt')

cong_committee_report(congress = 116, type = 'hrpt', number = 617)

cong_committee_report(congress = 116, type = 'hrpt', number = 617, item = 'text')

Request Congress Information

Description

Request Congress Information

Usage

cong_congress(
  congress = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_congress()

cong_congress(congress = 116)

Request daily Congressional Record Information

Description

Request daily Congressional Record Information

Usage

cong_daily_record(
  volume = NULL,
  issue = NULL,
  item = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

volume

Volume of the daily Congressional record. Character (or numeric).

issue

Issue of the daily Congressional record. Character (or numeric).

item

Information to request. Can be 'articles'

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_daily_record()

cong_daily_record(volume = 166)

cong_daily_record(volume = 168, issue = 153)

cong_daily_record(volume = 167, issue = 21, item = 'articles')

Request Hearing Information

Description

Request Hearing Information

Usage

cong_hearing(
  congress = NULL,
  chamber = NULL,
  number = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

chamber

Chamber name. Can be 'house', 'senate', or 'nochamber'.

number

Jacket number for the hearing. Character (or numeric).

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_hearing()

cong_hearing(congress = 116)

cong_hearing(chamber = 'house')

cong_hearing(congress = 116, chamber = 'house')

cong_hearing(congress = 116, chamber = 'house', number = 41365)

Request House Communication Information

Description

Request House Communication Information

Usage

cong_house_communication(
  congress = NULL,
  type = NULL,
  number = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

type

Type of communication. Can be 'ec', 'ml', 'pm', or 'pt'.

number

Communication assigned number. Numeric.

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_house_communication()

cong_house_communication(congress = 117)

cong_house_communication(congress = 117, type = 'ec')

cong_house_communication(congress = 117, type = 'ec', number = 3324)

Request House Requirement data

Description

Request House Requirement data

Usage

cong_house_requirement(
  number = NULL,
  item = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

number

Requirement's assigned number. Numeric.

item

Information to request. Can be 'matching-communications'.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_house_requirement()

cong_house_requirement(number = 12478)

cong_house_requirement(number = 8070, 'matching-communications')

Request Member Information

Description

Request Member Information

Usage

cong_member(
  bioguide = NULL,
  item = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

bioguide

Bioguide identifier for a member of Congress.

item

Information to request. Can be 'sponsored-legislation' or 'cosponsored-legislation'

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_member()

cong_member(bioguide = 'L000174', clean = TRUE)

cong_member(bioguide = 'L000174', item = 'sponsored-legislation')

Request Nomination Information

Description

Request Nomination Information

Usage

cong_nomination(
  congress = NULL,
  number = NULL,
  item = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

number

Nomination assigned number. Numeric.

item

Information to request. Can be 'actions', 'committees', '⁠hearings'⁠ or the ordinal number.

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_nomination()

cong_nomination(congress = 118)

cong_nomination(congress = 117, number = 2467)

cong_nomination(congress = 117, number = 2467, item = 'actions')

cong_nomination(congress = 117, number = 2467, item = 1)

Request Congressional Record Information

Description

Request Congressional Record Information

Usage

cong_record(
  year = NULL,
  month = NULL,
  day = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

year

integer for year

month

integer for month

day

integer for day of month

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_record()

cong_record(year = 2022, month = 6, day = 28)

Request next set of responses

Description

Request next set of responses

Usage

cong_request_next(response, max_req = 1)

Arguments

response

A tibble::tibble from a ⁠cong_*⁠ function

max_req

A max number of additional requests to make. Default is 1.

Value

a tibble with responses bound by row to new results

Examples

# Requires API Key

cong_bill() |>
 cong_request_next()

Request Senate Communication Information

Description

Request Senate Communication Information

Usage

cong_senate_communication(
  congress = NULL,
  type = NULL,
  number = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

type

Type of communication. Can be 'ec', 'pm', or 'pom'.

number

Communication assigned number. Numeric.

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_senate_communication()

cong_senate_communication(congress = 117)

cong_senate_communication(congress = 117, type = 'ec')

cong_senate_communication(congress = 117, type = 'ec', number = 2561)

Request Bill Summary Information

Description

Request Bill Summary Information

Usage

cong_summaries(
  congress = NULL,
  type = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

type

Type of bill. Can be 'hr', 's', 'hjres', 'sjres', 'hconres', 'sconres', 'hres', or 'sres'.

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_summaries()

cong_summaries(congress = 117)

cong_summaries(congress = 117, type = 'hr')

Request Treaty Information

Description

Request Treaty Information

Usage

cong_treaty(
  congress = NULL,
  number = NULL,
  suffix = NULL,
  item = NULL,
  from_date = NULL,
  to_date = NULL,
  limit = 20,
  offset = 0,
  format = "json",
  clean = TRUE
)

Arguments

congress

Congress number to search for. 81 or later are supported.

number

Treaty assigned number. Numeric.

suffix

Treaty partition letter value. Character.

item

Information to request. Can be 'actions', or 'committees'.

from_date

start date for search, e.g. '2022-04-01'. Defaults to most recent.

to_date

end date for search, e.g. '2022-04-03'. Defaults to most recent.

limit

number of records to return. Default is 20. Will be truncated to between 1 and 250.

offset

number of records to skip. Default is 0. Must be non-negative.

format

Output format for clean = FALSE. One of xml or json.

clean

Default is TRUE. Should output be returned as a tibble (TRUE) or requested format.

Value

tibble or HTTP response if clean = FALSE

Examples

# Requires API Key

cong_treaty()

cong_treaty(congress = 117)

cong_treaty(congress = 117, number = 3)

cong_treaty(congress = 114, number = 13, suffix = 'A')

cong_treaty(congress = 117, number = 3, item = 'actions')

cong_treaty(congress = 114, number = 13, suffix = 'A', item = 'actions')

Check or Get Congress API Key

Description

Check or Get Congress API Key

Usage

has_congress_key()

get_congress_key()

Value

logical if has, key if get

Examples

has_congress_key()

Add Entry to Renviron

Description

Adds Congress API key to .Renviron.

Usage

set_congress_key(key, overwrite = FALSE, install = FALSE)

Arguments

key

Character. API key to add to add.

overwrite

Defaults to FALSE. Boolean. Should existing CONGRESS_KEY in Renviron be overwritten?

install

Defaults to FALSE. Boolean. Should this be added '~/.Renviron' file?

Value

key, invisibly

Examples

## Not run: 
set_congress_key('1234')

## End(Not run)