\Header{getGroups.data.frame}{Extract Groups from a Data Frame}
\keyword{models}{getGroups.data.frame}
\begin{Description}\relax
Each variable named in the expression after the \code{|} operator on
the right hand side of \code{form} is evaluated in \code{object}. If
more than one variable is indicated in \code{level} they are combined
into a data frame; else the selected variable is returned as a vector.
When multiple grouping levels are defined in \code{form} and
\code{level > 1}, the levels of the returned factor are obtained by
pasting together the levels of the grouping factors of level greater
or equal to \code{level}, to ensure their uniqueness.
\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'data.frame':
getGroups(object, form, level, data, sep)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] an object inheriting from class \code{data.frame}.
\item[\code{form}] an optional formula with a conditioning expression on its
right hand side (i.e. an expression involving the \code{|}
operator). Defaults to \code{formula(object)}.
\item[\code{level}] a positive integer vector with the level(s) of grouping to
be used when multiple nested levels of grouping are present. Defaults
to all levels of nesting.
\item[\code{data}] unused
\item[\code{sep}] character, the separator to use between group levels when
multiple levels are collapsed.  The default is \code{'/'}.
\end{ldescription}
\end{Arguments}
\begin{Value}
either a data frame with columns given by the grouping factors
indicated in \code{level}, from outer to inner, or, when a single
level is requested, a factor representing the selected grouping
factor.
\end{Value}
\begin{Author}\relax
Jose Pinheiro \email{Jose.Pinheiro@pharma.novartis.com} and Douglas Bates \email{bates@stat.wisc.edu}
\end{Author}
\begin{SeeAlso}\relax
\code{\Link{getGroupsFormula}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(Pixel)
getGroups(Pixel)
getGroups(Pixel, level = 2)
\end{ExampleCode}
\end{Examples}

