% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/report.R
\name{generate_report}
\alias{generate_report}
\title{Generate a formatted survey report from predict_oyster() results}
\usage{
generate_report(
  result,
  output = "oyster_report.html",
  title = "Oyster Suitability Assessment",
  author = "",
  species = "ostrea_edulis",
  top_n = 5L,
  validation = NULL,
  comparison = NULL,
  open = TRUE
)
}
\arguments{
\item{result}{A dataframe returned by \code{\link[=predict_oyster]{predict_oyster()}}.}

\item{output}{Character. Output file path. Extension determines format:
\code{.pdf} for PDF, \code{.html} for HTML. Default \code{"oyster_report.pdf"}.}

\item{title}{Character. Report title. Default \code{"Oyster Suitability Assessment"}.}

\item{author}{Character. Author name(s) to appear on the title page.
Default \code{""} (omitted).}

\item{species}{Character. Species key used in \code{\link[=predict_oyster]{predict_oyster()}}.
Default \code{"ostrea_edulis"}.}

\item{top_n}{Integer. Number of top introduction sites to include in the
report (default \code{5}).}

\item{validation}{Named list or \code{NULL}. Optional output from
\code{\link[=validate_against_records]{validate_against_records()}}. When supplied, adds a Validation section
with ROC curve, AUC, TSS, and confusion-matrix metrics.}

\item{comparison}{Dataframe or \code{NULL}. Optional output from
\code{\link[=compare_species]{compare_species()}}. When supplied, adds a Competition Adjustment section
showing the \emph{M. gigas} competitive pressure penalty on \emph{O. edulis} scores.}

\item{open}{Logical. Open the report in your default viewer after rendering
(default \code{TRUE}).}
}
\value{
The output file path (invisibly).
}
\description{
Renders a structured assessment report from the output of \code{\link[=predict_oyster]{predict_oyster()}}.
The report includes an executive summary, suitability class breakdown,
per-variable scoring table, most common limiting factors, top introduction
sites, and a methodology section.

Output format is PDF by default (requires a LaTeX installation -- see Note
below). HTML is also supported and requires no additional system software.
}
\note{
\strong{HTML reports} (recommended) require \code{plotly} and \code{scales}:
\code{install.packages(c("plotly","scales"))}.
\strong{PDF reports} additionally require a LaTeX installation; see the
Note section below.

\strong{PDF output requires LaTeX.} If you don't have LaTeX installed,
either use \code{output = "report.html"} (no extra software needed), or install
a minimal LaTeX distribution with:

\if{html}{\out{<div class="sourceCode r">}}\preformatted{install.packages("tinytex")
tinytex::install_tinytex()
}\if{html}{\out{</div>}}
}
\examples{
\donttest{
result <- predict_oyster(survey, "ostrea_edulis",
                         output_geotiff = "kames_bay.tif")

# Standard HTML report (recommended -- Plotly charts, no LaTeX needed)
generate_report(result, "kames_bay_report.html",
                title  = "Kames Bay Oyster Habitat Assessment",
                author = "T. Tucker")

# With validation results embedded
val  <- validate_against_records(result, nbn_records)
generate_report(result, "kames_bay_validated.html",
                validation = val)

# With competition adjustment (when comparing species)
comp <- compare_species(survey,
          species = c("ostrea_edulis", "magallana_gigas"))
generate_report(result, "kames_bay_competition.html",
                comparison = comp)

# PDF report (requires LaTeX / tinytex)
generate_report(result, "kames_bay_report.pdf",
                title = "Kames Bay Oyster Habitat Assessment")
}
}
