% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pheno_combine.R
\name{pep_check_connectivity}
\alias{pep_check_connectivity}
\title{Check Station-Year Connectivity}
\usage{
pep_check_connectivity(pep, by = NULL)
}
\arguments{
\item{pep}{A \code{pep} object or data.table with \code{year}, \code{day},
and \code{s_id} columns.}

\item{by}{Optional grouping variables to check connectivity within groups.}
}
\value{
A list with connectivity information:
\describe{
\item{is_connected}{Logical. TRUE if all data forms one connected set.}
\item{n_sets}{Number of disconnected sets found.}
\item{set_sizes}{Number of observations in each set.}
\item{largest_set}{Stations and years in the largest connected set.}
}
}
\description{
Checks whether station-year combinations in phenological data form a
connected set, which is required for valid combined time series estimation.
}
\details{
Connectivity means that there exist overlapping years between stations,
allowing year effects to be separated from station effects. If data is
disconnected, the combined series cannot be uniquely estimated across
the disconnected parts.
}
\examples{
\donttest{
pep <- pep_download()
pep_alpine <- pep[country \%in\% c("Switzerland", "Austria")]
conn <- pep_check_connectivity(pep_alpine)
if (!conn$is_connected) {
  warning("Data has ", conn$n_sets, " disconnected sets")
}
}

}
\seealso{
\code{\link{pheno_combine}} which uses this internally
}
\author{
Matthias Templ
}
