Files
uscogdata/man/cog_find_peers.Rd
T
Claude 19b5b02d2f docs: render the roxygen markdown the reference pages are written in
The roxygen comments use markdown (**bold**, `code`, [cog_x()] links,
bullet lists) but DESCRIPTION had no `Roxygen: list(markdown = TRUE)`,
so the generated .Rd files carried that syntax literally. It also meant
a bare `%` started an Rd comment and silently cut the rest of its line
from seven places in the rendered pages, including "7% of the no-filter
floor", "-32.7% to +251.0% across 24 years" and the `filter(role %in%
...)` line of cog_peer_compare()'s example.

Adds the setting and regenerates man/ with roxygen2 7.3.3 (matching
RoxygenNote). The only source change is escaping one literal
"[min year, max year]" in an @noRd block in R/balance_caveats.R, which
markdown mode otherwise reads as a link. No wording or code changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qbe6u2h83wgZdTgJgE4Xh5
2026-11-04 20:21:24 +00:00

57 lines
2.2 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/peers.R
\name{cog_find_peers}
\alias{cog_find_peers}
\title{Find peer governments by similarity criteria}
\usage{
cog_find_peers(
target_govid,
year = NULL,
same_type = TRUE,
same_state = FALSE,
pop_range = c(0.7, 1.3),
is_ratio = TRUE,
max_peers = 10L,
coverage = c("all", "census", "consistent")
)
}
\arguments{
\item{target_govid}{Character scalar — \code{canonical_govid} of the target.}
\item{year}{Integer scalar. Cohort vintage. When \code{NULL} (default), uses the
most recent year for which the target has an observed population in
\code{gov_population_yearly}.}
\item{same_type}{If \code{TRUE} (default) restrict peers to the target's
\code{govs_type}.}
\item{same_state}{If \code{TRUE} restrict peers to the target's \code{fips_state}.
Default \code{FALSE}.}
\item{pop_range}{Length-2 numeric vector giving lower/upper bounds.}
\item{is_ratio}{If \code{TRUE} (default) \code{pop_range} is multiplied by the
target's population at \code{year} to produce absolute bounds. If \code{FALSE},
\code{pop_range} is interpreted as absolute population counts.}
\item{max_peers}{Integer cap on the number of peers returned.}
\item{coverage}{Survey-cycle handling; see \code{\link[=cog_peer_compare]{cog_peer_compare()}}. Here it
governs the cohort VINTAGE when \code{year} is \code{NULL}: \code{"census"} snaps to the
most recent census year with an observed population, so a cohort is not
built from a sample year in which most of the candidate universe is
absent. \code{"consistent"} needs a year range, which cohort selection does not
have, so it selects like \code{"all"} and is carried on the result as
\code{attr(x, "coverage")} for \code{\link[=cog_peer_compare]{cog_peer_compare()}}.}
}
\value{
Tibble with columns \code{canonical_govid}, \code{gov_name}, \code{fips_state},
\code{population}, \code{pop_ratio}, \code{rank}. The cohort year is attached as
\code{attr(x, "cohort_year")}.
}
\description{
Selects peer governments by combinations of government type, state, and
population range at a chosen \code{year}. Peers are ordered by \verb{|log(pop_ratio)|}
ascending (closest to the target's population first).
}