% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/subspecies_report.R
\name{summarize_subspecies_availability}
\alias{summarize_subspecies_availability}
\title{Summarize Subspecies Phenological Data Availability}
\usage{
summarize_subspecies_availability(
  pep,
  genus_name = NULL,
  species_name = NULL,
  subspecies_name = NULL,
  phases = c(65, 87),
  years = 1961:2024,
  subregions = c("Austria", "Germany-North", "Germany-South", "Switzerland"),
  include_empty = FALSE,
  metric = c("n_obs", "n_stations", "first_year", "last_year", "median_doy",
    "completeness")
)
}
\arguments{
\item{pep}{A PEP725-style data frame containing at least:
\code{genus}, \code{species}, \code{subspecies}, \code{country}, \code{year}, \code{phase_id},
\code{s_id}, and \code{day} or \code{DOY}.}

\item{genus_name}{Character (optional). Genus to filter.}

\item{species_name}{Character (optional). Species to filter.}

\item{subspecies_name}{Character vector (optional). One or more subspecies.}

\item{phases}{Integer vector. BBCH phases to evaluate.}

\item{years}{Numeric vector. Years to include.}

\item{subregions}{Character vector of region/country names.}

\item{include_empty}{Logical. If TRUE, include subspecies x country rows
even when no observations are present.}

\item{metric}{Character vector specifying which metrics to compute.
Allowed values:
\code{"n_obs"}, \code{"n_stations"}, \code{"first_year"}, \code{"last_year"},
\code{"median_doy"}, \code{"completeness"}, or \code{"all"}.}
}
\value{
A tibble in long format with one row per \verb{subspecies x country}.
}
\description{
Computes data availability metrics for specified genus, species, or
subspecies across BBCH phases and regions. Metrics include numbers of
observations, station counts, first/last observation years, median DOY,
and completeness ratios.
}
\examples{
\donttest{
pep <- pep_download()
pep_alpine <- pep[country \%in\% c("Switzerland", "Austria")]

# Grapevine species (longest historical records)
if (nrow(pep_alpine[species == "Vitis vinifera"]) > 0) {
  summarize_subspecies_availability(
    pep_alpine,
    species_name = "Vitis vinifera",
    subregions = c("Switzerland", "Austria"),
    metric = "all"
  )

  summarize_subspecies_availability(
    pep_alpine,
    subspecies_name = c("Vitis vinifera Riesling",
                        "Vitis vinifera MUELLER THURGAU WEISS"),
    subregions = c("Switzerland", "Austria"),
    metric = c("n_obs","median_doy")
  )
}
}
}
\author{
Matthias Templ
}
