% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/venndiagram.R
\name{prepare_venn_data}
\alias{prepare_venn_data}
\title{Prepare input data for Venn diagram rendering}
\usage{
prepare_venn_data(
  data,
  in_form = "auto",
  group_by = NULL,
  group_by_sep = "_",
  id_by = NULL
)
}
\arguments{
\item{data}{A data frame, a named list, or a \code{VennPlotData} object
to be prepared for Venn diagram rendering.  See the \strong{Input formats}
section for the expected structure of each format.}

\item{in_form}{A character string specifying the input format.  One of
\code{"auto"} (default; detect automatically via
\code{\link{detect_venn_datatype}()}), \code{"long"}, \code{"wide"},
\code{"list"}, or \code{"venn"}.}

\item{group_by}{A character string (or vector) specifying the column name(s)
identifying set membership.  For long-format data, a single column defines
the set; multiple columns are concatenated with \code{group_by_sep}.  For
wide-format data, these are the set columns (must be logical or 0/1); when
\code{NULL}, all columns are used as sets.  Ignored for list and
\code{VennPlotData} input.}

\item{group_by_sep}{A character string used to concatenate multiple
\code{group_by} columns when \code{in_form = "long"}.  Default \code{"_"}.}

\item{id_by}{A character string specifying the column name that identifies
individual elements.  Required for long-format data; ignored otherwise.}
}
\value{
A \code{VennPlotData} object suitable for rendering by
\pkg{ggVennDiagram}.
}
\description{
Converts data in any supported input format into a \code{VennPlotData}
object suitable for rendering by \pkg{ggVennDiagram}.  When
\code{in_form = "auto"} (the default), the format is detected via
\code{\link{detect_venn_datatype}()}.
}
\section{Input formats}{

\enumerate{
\item \strong{Long format} — a data frame with a grouping column
(\code{group_by}) identifying the set and an ID column
(\code{id_by}) identifying each element.  Multiple \code{group_by}
columns are concatenated with \code{group_by_sep}.
\preformatted{
group_by id_by
A        a1
A        a2
B        a1
B        a3
}
\item \strong{Wide format} — a data frame where each column represents a
set and each row an element.  Values must be logical or
\code{0}/\code{1}.  Columns specified in \code{group_by} define the
sets; if \code{group_by} is \code{NULL}, all columns are used.
\preformatted{
A    B
TRUE TRUE
TRUE FALSE
FALSE TRUE
}
\item \strong{List format} — a named list where each element is a vector
of identifiers belonging to that set.
\preformatted{
list(A = c("a1", "a2"), B = c("a1", "a3"))
}
\item \strong{VennPlotData} — a pre-computed object returned by a
previous call to \code{prepare_venn_data()}.  Returned as-is.
}
}

\keyword{internal}
