diff --git a/R/revenue.R b/R/revenue.R index 393cf3c..c577556 100644 --- a/R/revenue.R +++ b/R/revenue.R @@ -11,7 +11,7 @@ #' @return Tibble with columns `year`, `canonical_govid`, `gov_name`, #' `revenue_subtype`, `category`, `amt_nominal`, optional `amt_real`, #' optional `amt_per_capita_nominal`, optional `amt_per_capita_real`, -#' `codes_included`, `aggregate_fallback`, `notes`. +#' optional `pop_source`, `codes_included`, `aggregate_fallback`, `notes`. #' @export cog_revenue <- function(govid, years, category = NULL, per_capita = FALSE, adjust_to_year = NULL) { diff --git a/R/spending.R b/R/spending.R index e8bd7dd..6132224 100644 --- a/R/spending.R +++ b/R/spending.R @@ -13,15 +13,18 @@ #' @param category Character vector of category names (from #' `summary_categories.category`), or `NULL` for all categories. #' @param per_capita If `TRUE`, adds `amt_per_capita_nominal` (and -#' `amt_per_capita_real` when `adjust_to_year` is set) using -#' `population_acs` from the canonical xwalk. +#' `amt_per_capita_real` when `adjust_to_year` is set) using the per-year +#' Census F-33 population from `gov_population_yearly`. Result also gains +#' a `pop_source` column with values `"census_f33"` or `"unavailable"` +#' (the latter for gov types 4/5 and any row whose population is missing +#' in that year). #' @param adjust_to_year Integer base year for CPI-U real-dollar conversion, #' or `NULL` for nominal only. #' @return Tibble with columns `year`, `canonical_govid`, `gov_name`, #' `spend_subtype`, `category`, `amt_nominal`, optional `amt_real`, #' optional `amt_per_capita_nominal`, optional `amt_per_capita_real`, -#' `codes_included`, `aggregate_fallback`, `notes`. Carries a `provenance` -#' attribute matching `inst/schemas/provenance-v1.json`. +#' optional `pop_source`, `codes_included`, `aggregate_fallback`, `notes`. +#' Carries a `provenance` attribute matching `inst/schemas/provenance-v1.json`. #' @export cog_spending <- function(govid, years, category = NULL, per_capita = FALSE, adjust_to_year = NULL) { diff --git a/man/cog_revenue.Rd b/man/cog_revenue.Rd index 96f1f3f..d05aac8 100644 --- a/man/cog_revenue.Rd +++ b/man/cog_revenue.Rd @@ -21,8 +21,11 @@ cog_revenue( `summary_categories.category`), or `NULL` for all categories.} \item{per_capita}{If `TRUE`, adds `amt_per_capita_nominal` (and -`amt_per_capita_real` when `adjust_to_year` is set) using -`population_acs` from the canonical xwalk.} +`amt_per_capita_real` when `adjust_to_year` is set) using the per-year +Census F-33 population from `gov_population_yearly`. Result also gains +a `pop_source` column with values `"census_f33"` or `"unavailable"` +(the latter for gov types 4/5 and any row whose population is missing +in that year).} \item{adjust_to_year}{Integer base year for CPI-U real-dollar conversion, or `NULL` for nominal only.} @@ -31,7 +34,7 @@ or `NULL` for nominal only.} Tibble with columns `year`, `canonical_govid`, `gov_name`, `revenue_subtype`, `category`, `amt_nominal`, optional `amt_real`, optional `amt_per_capita_nominal`, optional `amt_per_capita_real`, - `codes_included`, `aggregate_fallback`, `notes`. + optional `pop_source`, `codes_included`, `aggregate_fallback`, `notes`. } \description{ Mirror of [cog_spending()] for revenue categories. One row per diff --git a/man/cog_spending.Rd b/man/cog_spending.Rd index 36f60fc..a7b9bbb 100644 --- a/man/cog_spending.Rd +++ b/man/cog_spending.Rd @@ -21,8 +21,11 @@ cog_spending( `summary_categories.category`), or `NULL` for all categories.} \item{per_capita}{If `TRUE`, adds `amt_per_capita_nominal` (and -`amt_per_capita_real` when `adjust_to_year` is set) using -`population_acs` from the canonical xwalk.} +`amt_per_capita_real` when `adjust_to_year` is set) using the per-year +Census F-33 population from `gov_population_yearly`. Result also gains +a `pop_source` column with values `"census_f33"` or `"unavailable"` +(the latter for gov types 4/5 and any row whose population is missing +in that year).} \item{adjust_to_year}{Integer base year for CPI-U real-dollar conversion, or `NULL` for nominal only.} @@ -31,8 +34,8 @@ or `NULL` for nominal only.} Tibble with columns `year`, `canonical_govid`, `gov_name`, `spend_subtype`, `category`, `amt_nominal`, optional `amt_real`, optional `amt_per_capita_nominal`, optional `amt_per_capita_real`, - `codes_included`, `aggregate_fallback`, `notes`. Carries a `provenance` - attribute matching `inst/schemas/provenance-v1.json`. + optional `pop_source`, `codes_included`, `aggregate_fallback`, `notes`. + Carries a `provenance` attribute matching `inst/schemas/provenance-v1.json`. } \description{ One row per `(year, canonical_govid, spend_subtype, category)`. Amounts are