48 lines
1.5 KiB
R
48 lines
1.5 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/peers.R
|
|
\name{cog_peer_compare}
|
|
\alias{cog_peer_compare}
|
|
\title{Compare a target government against a peer set}
|
|
\usage{
|
|
cog_peer_compare(
|
|
target_govid,
|
|
peers,
|
|
category,
|
|
years,
|
|
per_capita = TRUE,
|
|
adjust_to_year = NULL
|
|
)
|
|
}
|
|
\arguments{
|
|
\item{target_govid}{Character scalar.}
|
|
|
|
\item{peers}{A tibble from [cog_find_peers()] or a character vector of
|
|
`canonical_govid`s.}
|
|
|
|
\item{category}{Character scalar or vector.}
|
|
|
|
\item{years}{Integer vector.}
|
|
|
|
\item{per_capita}{Default `TRUE` — peer compare usually normalizes by
|
|
population.}
|
|
|
|
\item{adjust_to_year}{Integer base year for CPI-U conversion or `NULL`.}
|
|
}
|
|
\value{
|
|
Tibble matching [cog_spending()]'s columns, plus a `role`
|
|
column taking values `"target"`, `"peer"`, `"summary_p25"`,
|
|
`"summary_p50"`, or `"summary_p75"`, `target_rank` (target's rank
|
|
among target+peers at `max(years)`, NA for other rows), and
|
|
`cohort_year` (the year used to build the peer cohort, read from
|
|
`attr(peers, "cohort_year")`; `NA` when `peers` was a bare character
|
|
vector). Provenance reports `verb = "cog_peer_compare"`, `peer_count`,
|
|
`cohort_year`, and `cohort_govids`.
|
|
}
|
|
\description{
|
|
Pulls spending for the target plus a peer set (either a
|
|
[cog_find_peers()] result or a character vector of `canonical_govid`) and
|
|
appends peer-distribution summary rows (`summary_p25`, `summary_p50`,
|
|
`summary_p75`) so the result can be faceted by `role` in a single ggplot
|
|
call.
|
|
}
|