% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/leakage-audit.R
\name{write_gazepoint_ml_leakage_audit_csv}
\alias{write_gazepoint_ml_leakage_audit_csv}
\title{Write a Gazepoint ML leakage-audit table to CSV}
\usage{
write_gazepoint_ml_leakage_audit_csv(
  x,
  file,
  table = c("issues", "checks", "partition_summary"),
  overwrite = FALSE,
  na = ""
)
}
\arguments{
\item{x}{An object returned by
\code{\link[=audit_gazepoint_ml_leakage]{audit_gazepoint_ml_leakage()}}.}

\item{file}{A single output file path ending in \code{.csv}.}

\item{table}{The audit table to export. One of \code{"issues"},
\code{"checks"}, or \code{"partition_summary"}.}

\item{overwrite}{Logical. When \code{FALSE}, the default, an existing
output file causes an error.}

\item{na}{Character value used for missing values in the CSV file.}
}
\value{
The normalized output path, invisibly.
}
\description{
Writes one machine-readable table from a leakage-audit object to a
UTF-8 CSV file. Existing files are not replaced unless explicitly
permitted.
}
\examples{
analysis <- data.frame(
  participant_id = c("P01", "P02"),
  trial_id = c("T01", "T02"),
  outcome = c(0, 1),
  feature = c(1.2, 1.8)
)

assessment <- data.frame(
  participant_id = c("P03", "P04"),
  trial_id = c("T03", "T04"),
  outcome = c(1, 0),
  feature = c(2.1, 2.4)
)

audit <- audit_gazepoint_ml_leakage(
  analysis = analysis,
  assessment = assessment,
  outcome = "outcome",
  predictors = "feature",
  participant_id = "participant_id",
  trial_id = "trial_id",
  generalization_target = "new_participants"
)

output <- tempfile(fileext = ".csv")

write_gazepoint_ml_leakage_audit_csv(
  audit,
  output,
  table = "checks"
)

unlink(output)

}
