% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api-results.R
\name{export_mfrm_results}
\alias{export_mfrm_results}
\title{Export a lightweight mfrm_results archive}
\usage{
export_mfrm_results(
  x,
  output_dir = ".",
  prefix = "mfrmr_results",
  include = "default",
  overwrite = FALSE,
  zip_bundle = FALSE,
  zip_name = NULL,
  plot_width = 1200,
  plot_height = 900,
  plot_res = 144
)
}
\arguments{
\item{x}{An \code{\link[=mfrm_results]{mfrm_results()}} object.}

\item{output_dir}{Directory where files should be written.}

\item{prefix}{File-name prefix. Non-alphanumeric characters are converted to
underscores.}

\item{include}{Export components. \code{"default"} expands to \code{"summary"},
\code{"tables"}, \code{"html"}, \code{"rds"}, \code{"replay"}, and \code{"manifest"}. Add
\code{"report"} to write \code{\link[=mfrm_report]{mfrm_report()}} tables plus Markdown and HTML; add
\code{"plots"} to write available plot routes as PNG files, or use \code{"all"}.}

\item{overwrite}{Logical; if \code{FALSE}, existing files stop the export.}

\item{zip_bundle}{Logical; if \code{TRUE}, create a best-effort zip archive of
the written files.}

\item{zip_name}{Optional zip file name. When omitted,
\verb{\{prefix\}_mfrm_results.zip} is used.}

\item{plot_width, plot_height, plot_res}{PNG device settings used when
\code{include} contains \code{"plots"}.}
}
\value{
An \code{mfrm_results_export} object with \code{summary}, \code{written_files},
\code{plot_errors}, and zip status fields.
}
\description{
\code{export_mfrm_results()} writes the contents of an existing \code{\link[=mfrm_results]{mfrm_results()}}
object to a small shareable folder. It is a results-download helper for the
comprehensive first-screen workflow, not a new estimation, diagnostics, or
validation step.
}
\details{
The helper writes:
\itemize{
\item summary CSVs from \code{summary(x)} such as overview, status, triage, plot
routes, next actions, mapping, and replay-code lines;
\item collected \code{x$tables} as CSV files;
\item optional report artifacts from \code{mfrm_report(x)}, including report-index,
evidence-summary, and reporting-template CSVs plus Markdown and HTML;
\item a lightweight HTML report equivalent to \code{mfrm_results(x, output = "html")}
for the already-created object;
\item an \code{.rds} copy of the \code{mfrm_results} object;
\item a replay \code{.R} scaffold from \code{x$input$reproducible_code};
\item a written-files manifest and compact export summary.
}

Plot export is intentionally optional because some plot routes can be
comparatively slow or require richer graphics devices. Plot failures are
recorded in the returned \code{plot_errors} table rather than stopping the export.
}
\examples{
\donttest{
toy <- load_mfrmr_data("example_core")
toy_small <- toy[toy$Person \%in\% unique(toy$Person)[1:6], , drop = FALSE]
fit <- fit_mfrm(toy_small, "Person", c("Rater", "Criterion"), "Score",
                method = "JML", maxit = 30)
res <- mfrm_results(fit, include = c("fit", "diagnostics", "tables"))

exported <- export_mfrm_results(
  res,
  output_dir = tempdir(),
  prefix = "mfrmr_results_example",
  overwrite = TRUE
)
exported$summary[, c("FilesWritten", "CsvWritten", "HtmlWritten")]
}
}
\seealso{
\code{\link[=mfrm_results]{mfrm_results()}}, \code{\link[=launch_mfrmr_viewer]{launch_mfrmr_viewer()}},
\code{\link[=export_mfrm_bundle]{export_mfrm_bundle()}}, \code{\link[=export_summary_appendix]{export_summary_appendix()}}
}
