cog_find_peers selects peers from canonical_fips_xwalk by same-type,
same-state, and population-range (ratio or absolute) criteria,
ordered by |log(pop_ratio)| ascending.
cog_peer_compare accepts the find_peers result (or a plain character
vector of govids), pulls spending for target + peers via cog_spending,
and appends summary rows (summary_p25/p50/p75) so the whole result
can be faceted by `role` in a single ggplot call. Summary rows honor
per_capita + adjust_to_year by picking the right value column.
target_rank reports the target's rank among target+peers at max(years).
Provenance is rewritten with verb = cog_peer_compare and peer_count.
Also: globalVariables('.data') in zzz.R to silence R CMD check on
tidy-eval pronouns.
Tests: 21 new / 120 total pass. devtools::check() 0E/0W/2N.
15 lines
357 B
R
15 lines
357 B
R
# R/zzz.R
|
|
|
|
.onLoad <- function(libname, pkgname) {
|
|
invisible(NULL)
|
|
}
|
|
|
|
# Silence R CMD check "no visible binding" for tidy-eval pronouns used in
|
|
# dplyr verbs. `.data` comes from rlang and is guaranteed to resolve at
|
|
# evaluation time inside dplyr data-masking contexts.
|
|
utils::globalVariables(c(".data"))
|
|
|
|
.onUnload <- function(libpath) {
|
|
cog_close()
|
|
}
|