% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pedanalysis.R
\name{pedsubpop}
\alias{pedsubpop}
\title{Pedigree Subpopulations}
\usage{
pedsubpop(ped, by = NULL)
}
\arguments{
\item{ped}{A \code{tidyped} object.}

\item{by}{Character. The name of the column to group by. 
If NULL, summarizes disconnected components via \code{\link{splitped}}.}
}
\value{
A \code{data.table} with columns:
\itemize{
  \item \code{Group}: Subpopulation label.
  \item \code{N}: Total individuals.
  \item \code{N_Sire}: Number of distinct sires.
  \item \code{N_Dam}: Number of distinct dams.
  \item \code{N_Founder}: Number of founders (parents unknown).
}
}
\description{
Summarizes pedigree subpopulations and group structure.
}
\details{
When \code{by = NULL}, this function is a lightweight summary wrapper around
\code{\link{splitped}}, returning one row per disconnected pedigree component
plus an optional \code{"Isolated"} row for individuals with no known parents
and no offspring. When \code{by} is provided, it instead summarizes the pedigree
directly by the specified column (e.g. \code{"Gen"}, \code{"Year"}, \code{"Breed"}).


Use \code{pedsubpop()} when you want a compact analytical summary table.
Use \code{\link{splitped}} when you need the actual re-tidied sub-pedigree
objects for downstream plotting or analysis.
}
\examples{
tp <- tidyped(simple_ped)

# Summarize disconnected pedigree components
pedsubpop(tp)

# Summarize by an existing grouping variable
pedsubpop(tp, by = "Gen")

}
