% 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). }