% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/target.R
\name{wf_target_population}
\alias{wf_target_population}
\title{Target from external population data}
\usage{
wf_target_population(
  pop,
  key_map,
  count,
  dims,
  by = NULL,
  by_key = NULL,
  scale = c("population", "sample", "custom"),
  sample = NULL,
  totals = NULL,
  keep_joint = FALSE
)
}
\arguments{
\item{pop}{Population data frame.}

\item{key_map}{Named character vector mapping \code{wf_dims} dimensions to population columns.}

\item{count}{Population count column.}

\item{dims}{A \code{wf_dims} object.}

\item{by}{Optional grouping variable.}

\item{by_key}{Optional group key column name or function.}

\item{scale}{Target scale, one of \code{"population"}, \code{"sample"}, or \code{"custom"}.}

\item{sample}{Required when \code{scale = "sample"}.}

\item{totals}{Required when \code{scale = "custom"}.}

\item{keep_joint}{Whether to retain per-group joint population cells.}
}
\value{
A \code{wf_target} object.
}
\description{
Converts arbitrary population data to a canonical \code{wf_target} object.
}
\examples{
dims <- wf_dims(gender = c("female", "male"))
pop <- data.frame(gender = c("female", "male"), count = c(55, 45))
wf_target_population(pop, c(gender = "gender"), "count", dims)
}
