% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utilities.R
\name{write_symbolic_csv}
\alias{write_symbolic_csv}
\title{Write Symbolic Data to a CSV File}
\usage{
write_symbolic_csv(
  x,
  file,
  sep = ",",
  row.names = TRUE,
  na = "NA",
  quote = TRUE,
  ...
)
}
\arguments{
\item{x}{A \code{data.frame}, \code{symbolic_tbl}, or other tabular object
containing symbolic data.}

\item{file}{Path to the output CSV file.}

\item{sep}{Field separator character. Default \code{","}.}

\item{row.names}{Logical or character.  If \code{TRUE} (the default),
row names are written as the first column.}

\item{na}{Character string to use for missing values.  Default \code{"NA"}.}

\item{quote}{Logical; should character and factor columns be quoted?
Default \code{TRUE}.}

\item{\dots}{Additional arguments passed to \code{\link[utils]{write.table}}.}
}
\value{
Invisibly returns the data frame that was written (after any
  conversion).
}
\description{
Writes a symbolic data object (interval, histogram, modal, or any
data frame) to a CSV file.  Interval data stored in RSDA format
(\code{symbolic_tbl} with complex columns) is automatically converted to
MM format (paired \code{_min}/\code{_max} columns) before writing.
}
\details{
\code{write_symbolic_csv} handles every tabular symbolic type stored in
\pkg{dataSDA}:
\itemize{
  \item \strong{Interval (RSDA)}: \code{symbolic_tbl} objects with complex
    interval columns are converted to MM format before writing.
  \item \strong{Interval (MM)}: Data frames with \code{_min}/\code{_max}
    columns are written directly.
  \item \strong{Histogram / Modal / Other}: Plain data frames are written
    directly.
}
The output is a standard CSV that can be read back with
\code{\link{read_symbolic_csv}}.
}
\examples{
# Interval data (RSDA symbolic_tbl)
data(mushroom.int)
tmp <- tempfile(fileext = ".csv")
write_symbolic_csv(mushroom.int, tmp)
cat(readLines(tmp, n = 3), sep = "\n")

# Histogram data
data(airline_flights.hist)
tmp2 <- tempfile(fileext = ".csv")
write_symbolic_csv(airline_flights.hist, tmp2)
cat(readLines(tmp2, n = 3), sep = "\n")
}
\seealso{
\code{\link{read_symbolic_csv}}
}
