% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utilities.R
\name{read_symbolic_csv}
\alias{read_symbolic_csv}
\title{Read a Symbolic Data CSV File}
\usage{
read_symbolic_csv(
  file,
  sep = ",",
  header = TRUE,
  row.names = NULL,
  stringsAsFactors = FALSE,
  na.strings = c("", "NA"),
  symbolic_type = NULL,
  ...
)
}
\arguments{
\item{file}{Path to the CSV file to read.}

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

\item{header}{Logical; does the first row contain column names?
Default \code{TRUE}.}

\item{row.names}{Column number or character string giving row names.
Passed to \code{\link[utils]{read.table}}.  Default \code{NULL} (automatic).}

\item{stringsAsFactors}{Logical; should character columns be converted to
factors? Default \code{FALSE}.}

\item{na.strings}{Character vector of strings to interpret as \code{NA}.
Default \code{c("", "NA")}.}

\item{symbolic_type}{Optional character string to override automatic type
detection.  One of \code{"interval"}, \code{"histogram"}, \code{"modal"},
or \code{"other"}.  When \code{NULL} (the default) the type is detected
automatically.}

\item{\dots}{Additional arguments passed to \code{\link[utils]{read.table}}.}
}
\value{
A \code{data.frame}.  Interval data is returned in MM format
  (paired \code{_min}/\code{_max} columns).  All other symbolic types are
  returned as plain data frames.
}
\description{
Reads an external CSV file containing symbolic data, automatically detects
whether the data is interval-valued (min/max pairs or comma-separated),
histogram-valued, modal-valued, or another symbolic type, and returns an
appropriate R object.
}
\details{
The detection heuristic works as follows:
\enumerate{
  \item \strong{Interval (MM)}: If the file contains paired
    \code{_min}/\code{_max} columns the data is returned as-is (MM format).
  \item \strong{Interval (iGAP)}: If one or more character columns contain
    comma-separated numeric pairs (e.g., \code{"1.2,3.4"}) they are
    expanded into \code{_min}/\code{_max} column pairs and the result is
    returned in MM format.
  \item \strong{Histogram / Modal}: If columns follow a \code{VarName(bin)}
    naming pattern (e.g., \code{Crime(violent)}) and the proportions within
    each variable group sum to approximately 1, the data is classified as
    histogram or modal.  It is returned as a plain \code{data.frame}.
  \item \strong{Other}: If none of the above patterns match, the data is
    returned as a plain \code{data.frame}.
}
}
\examples{
# Write then read back an interval dataset
data(mushroom.int.mm)
tmp <- tempfile(fileext = ".csv")
write_symbolic_csv(mushroom.int.mm, tmp)
df <- read_symbolic_csv(tmp)
head(df)

# Write then read back a histogram dataset
data(airline_flights.hist)
tmp2 <- tempfile(fileext = ".csv")
write_symbolic_csv(airline_flights.hist, tmp2)
df2 <- read_symbolic_csv(tmp2)
head(df2)
}
\seealso{
\code{\link{write_symbolic_csv}}, \code{\link{int_detect_format}},
  \code{\link{int_convert_format}}
}
