Functions to retrieve federal account information for agencies, including account details, counts, and associated treasury accounts.
Usage
agency_federal_account(
toptier_code,
fiscal_year = NULL,
.page_all = FALSE,
...
)
agency_federal_account_count(toptier_code, fiscal_year = NULL, ...)
Arguments
- toptier_code
A character string containing a 3-4 digit numeric code that uniquely identifies a top-tier federal agency (e.g., "086" for Department of Housing and Urban Development). Must be a valid CGAC (Common Government-wide Accounting Classification) or FREC (Federal Record Classification) code.
- fiscal_year
Optional numeric value specifying the fiscal year for the query. If NULL (default), the API will use the current fiscal year. Must be 2017 or later.
- .page_all
Logical indicating whether to retrieve all pages of results (TRUE) or just the first page (FALSE, default). When TRUE, the function will automatically handle pagination to retrieve the complete dataset.
- ...
Additional parameters passed to specific API endpoints. Common options include:
page
: Integer specifying the page number to retrieve (default: 1)limit
: Integer specifying number of records per page (default: 10)sort
: Field to sort results by (varies by endpoint)order
: Sort direction: "asc" or "desc" (default varies by endpoint)
Value
Each function returns a tibble with different structures:
agency_federal_account()
returns:code
: Federal account codename
: Account nametotal_budgetary_resources
: Total resourcesobligated_amount
: Amount obligatedgross_outlay_amount
: Gross outlay amountchildren
: Nested data frame of treasury account details
agency_federal_account_count()
returns:toptier_code
: Agency identifier codefiscal_year
: Fiscal yearfederal_account_count
: Number of federal accountstreasury_account_count
: Number of treasury accounts