Skip to contents

Functions to retrieve budget-related information for federal agencies, including budget functions, budgetary resources, and obligations by award category.

Usage

agency_budget_function_count(toptier_code, fiscal_year = NULL, ...)

agency_budget_functions(
  toptier_code,
  fiscal_year = NULL,
  .page_all = FALSE,
  ...
)

agency_budget_resources(toptier_code, ...)

agency_obligations_by_award_category(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.

...

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)

.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.

Value

Each function returns a tibble with different structures:

  • agency_budget_functions() returns:

    • name: Budget function name

    • obligated_amount: Amount obligated

    • gross_outlay_amount: Gross outlay amount

    • children: Nested data frame of subfunction details

  • agency_budget_function_count() returns:

    • toptier_code: Agency identifier code

    • fiscal_year: Fiscal year

    • budget_function_count: Number of budget functions

    • budget_sub_function_count: Number of budget subfunctions

  • agency_budget_resources() returns:

    • fiscal_year: Fiscal year

    • agency_budgetary_resources: Total agency budget

    • agency_total_obligated: Total obligations

    • total_budgetary_resources: Government-wide total budget

    • agency_obligation_by_period: Nested data frame of periodic obligations

  • agency_obligations_by_award_category() returns:

    • total_aggregated_amount: Total award obligations

    • results: List of obligation amounts by award category

Examples

if (FALSE) { # interactive()
# Get budget functions for HUD
budget_funcs <- agency_budget_functions("086", fiscal_year = 2023)

# Get budget function counts
func_counts <- agency_budget_function_count("086", fiscal_year = 2023)

# Get budgetary resources for HUD
budget_resources <- agency_budget_resources("086")

# Get obligations by award category
award_obligations <- agency_obligations_by_award_category("086", fiscal_year = 2023)
}