% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/select_phases.R
\name{select_phases}
\alias{select_phases}
\title{Select and combine phases for overlap analyses}
\usage{
select_phases(data, A, B, phase_names = "auto")
}
\arguments{
\item{data}{A single-case data frame. See \code{\link[=scdf]{scdf()}} to learn about this
format.}

\item{A}{Selection of the A phase}

\item{B}{Selection of the B phase}

\item{phase_names}{A character vector with names for the resulting phases.
The default \code{"auto"} generates phase names from the combination of the
names of the recombined phases.}
}
\value{
An scdf with selected phases
}
\description{
Useful when working with pipe operators. This function allows to select and
combine specific phases from an scdf for overlap analyses. For example, in an
ABAB design one might want to combine both A phases and both B phases (e.g.,
\code{A = c(1, 3)}, \code{B = c(2, 4)}). The resulting scdf can then be used in overlap
functions such as \code{\link[=overlap]{overlap()}}.
}
\details{
This function selects and combines the specified phases from the
input scdf and returns the resulting scdf with the selected phases only.
This is particularly useful when working with pipe operators, allowing to
select and combine phases before applying overlap functions. The resulting
scdf contains only the selected and combined phases, with phase labels "A"
and "B". If \code{phase_names = "auto"}, phase names are generated from the
combination of the names of the recombined phases. For example, combining
phases 1 and 3 will result in the phase name "1_3". This function
simplifies the process of preparing data for overlap analyses by allowing
users to easily select and combine phases in a single step.
}
\examples{
exampleA1B1A2B2_zvt |>
  select_phases(A = c(1, 3), B = c(2, 4)) |>
  overlap()
}
\seealso{
Other overlap functions: 
\code{\link{ird}()},
\code{\link{nap}()},
\code{\link{overlap}()},
\code{\link{pand}()},
\code{\link{pem}()},
\code{\link{pet}()},
\code{\link{pnd}()},
\code{\link{print.sc_cdc}()},
\code{\link{tau_u}()}
}
\author{
Juergen Wilbert
}
\concept{overlap functions}
\keyword{overlap}
