% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/as_caseform.R
\name{as_caseform}
\alias{as_caseform}
\title{Convert frequency or table form into case form.}
\usage{
as_caseform(obj, freq = "Freq", dims = NULL, tidy = TRUE)
}
\arguments{
\item{obj}{Object to be converted to case form.}

\item{freq}{If \code{obj} is in frequency form, this is the name of the frequency column. If
\code{obj} is in any other form, do not supply an argument (see "Details").}

\item{dims}{A character vector of dimensions. If not specified, all variables apart from
\code{freq} will be used as dimensions.}

\item{tidy}{Returns a tibble if set to \code{TRUE}.}
}
\value{
object in case form.
}
\description{
Converts object (\code{obj}) in frequency or table form into case form. The
column containing the frequencies (\code{freq}) must be supplied if \code{obj} is in
frequency form. Returns a tibble if \code{tidy} is set to \code{TRUE}.
}
\details{
A wrapper for \code{\link{expand.dft}} that is able to handle arrays.

If a frequency column is not supplied, this function defaults to "Freq"
just like \code{\link{expand.dft}}. Converts \code{obj} to a table using
\code{\link{as_table}} before converting to case form.
}
\examples{
library(vcdExtra)

data("HairEyeColor")

freqForm <- as.data.frame(HairEyeColor) # Generate frequency form data
tidy_freqForm <- dplyr::as_tibble(HairEyeColor) # Generate tidy frequency form data
tableForm <- as_table(HairEyeColor) # Generate table form data
arrayDat <- as_array(HairEyeColor) # Generate an array

# Frequency form -> case form
as_caseform(freqForm) |> str()

# Frequency form (tibble) -> case form
as_caseform(tidy_freqForm, freq = "n") |> str()

# Array -> case form
as_caseform(arrayDat) |> str()

# Optionally specify dims
as_caseform(tableForm, dims = c("Hair", "Eye")) |> str()


}
\seealso{
\code{\link{as_table}}, \code{\link{as_freqform}}, \code{\link{as_array}},
\code{\link{as_matrix}}, \code{\link{expand.dft}}
}
\author{
Gavin M. Klorfine
}
