\Header{model.frame}{Extracting the ``Environment'' of a Model Formula}
\methalias{model.frame.aovlist}{model.frame}
\methalias{model.frame.default}{model.frame}
\methalias{model.frame.glm}{model.frame}
\methalias{model.frame.lm}{model.frame}
\keyword{models}{model.frame}
\begin{Description}\relax
\code{model.frame} (generic function) and its methods return a
\code{\Link{data.frame}} with the variables from \code{formula}.\end{Description}
\begin{Usage}
\begin{verbatim}
model.frame(formula, ...)
model.frame.default(formula, data = parent.frame(),
                    subset = NULL, na.action,
                    drop.unused.levels = FALSE, xlev = NULL, ...)

Methods for
        lm      glm     aovlist
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{formula}] a model formula
\item[\code{data}] \code{data.frame}, list, \code{environment} or object
coercible to \code{data.frame} containing the variables in
\code{formula}.
\item[\code{subset}] a specification of the rows to be used. Defaults to all rows.
\item[\code{na.action}] how \code{NA}s are treated. The default is first,
any \code{na.action} attribute of \code{data}, second
a \code{na.action} setting of \code{\Link{options}}, and third
\code{\Link{na.fail}} if that is unset.  The ``factory-fresh''
default is \code{\Link{na.omit}}.
\item[\code{drop.unused.levels}] should factors have unused levels dropped?
Defaults to \code{FALSE}.
\item[\code{xlev}] a named list of character vectors giving the full set of levels
to be assumed for each factor.
\item[\code{...}] further arguments such as \code{subset}, \code{offset} and
\code{weights}. \code{NULL} arguments are treated as missing.
\end{ldescription}
\end{Arguments}
\begin{Value}
A \code{\Link{data.frame}} containing the variables used in
\code{formula}.\end{Value}
\begin{SeeAlso}\relax
\code{\Link{model.matrix}} for the ``design matrix'',
\code{\Link{formula}} for formulas  and
\code{\Link{expand.model.frame}} for model.frame manipulation.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(cars)
data.class(model.frame(dist ~ speed, data = cars))
\end{ExampleCode}
\end{Examples}

