\Header{data.frame}{Data Frames}
\alias{as.data.frame}{data.frame}
\methalias{as.data.frame.AsIs}{data.frame}
\methalias{as.data.frame.character}{data.frame}
\methalias{as.data.frame.complex}{data.frame}
\methalias{as.data.frame.data.frame}{data.frame}
\methalias{as.data.frame.default}{data.frame}
\methalias{as.data.frame.factor}{data.frame}
\methalias{as.data.frame.integer}{data.frame}
\methalias{as.data.frame.list}{data.frame}
\methalias{as.data.frame.logical}{data.frame}
\methalias{as.data.frame.matrix}{data.frame}
\methalias{as.data.frame.model.matrix}{data.frame}
\methalias{as.data.frame.numeric}{data.frame}
\methalias{as.data.frame.ordered}{data.frame}
\methalias{as.data.frame.ts}{data.frame}
\methalias{as.data.frame.vector}{data.frame}
\alias{is.data.frame}{data.frame}
\alias{plot.data.frame}{data.frame}
\alias{row.names}{data.frame}
\methalias{row.names.data.frame}{data.frame}
\methalias{row.names.default}{data.frame}
\alias{row.names<\Rdash}{data.frame}
\methalias{row.names<\Rdash.data.frame}{data.frame}
\methalias{row.names<\Rdash.default}{data.frame}
\alias{xpdrows.data.frame}{data.frame}
\alias{[.AsIs}{data.frame}
\keyword{classes}{data.frame}
\keyword{methods}{data.frame}
\begin{Description}\relax
These functions create or manipulate data frames, tightly coupled
collections of variables which share many of the properties of
matrices and of lists, used as the fundamental data structure by most
of \R's modeling software.\end{Description}
\begin{Usage}
\begin{verbatim}
data.frame(..., row.names = NULL, check.rows = FALSE,
        check.names = TRUE)

as.data.frame(x, row.names = NULL, optional = FALSE)
is.data.frame(x)

row.names(x)
row.names(x) <- names
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{...}] these arguments are of either the form \code{value} or
\code{tag=value}.  Component names are created based on the tag (if
present) or the deparsed argument itself.
\item[\code{row.names}] a character vector giving the row names for the data
frame.
\item[\code{check.rows}] if \code{TRUE} then the rows are checked for
consistency of length and names.
\item[\code{check.names}] logical.  If \code{TRUE} then the names of the
variables in the data frame are checked to ensure that they are
syntactically valid variable names.  If necessary they are adjusted
(by \code{\Link{make.names}}) so that they are.
\item[\code{optional}] logical. If \code{TRUE}, setting row names is
optional.
\item[\code{x}] object of class \code{data.frame}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Character variables passed to \code{data.frame} are converted to
factor columns unless protected by \code{\Link{I}}. It also applies to
adding columns to a data frame.

If a list or data frame or matrix is passed to \code{data.frame}
it is as if each column had been passed as a separate argument,
with the exception of matrices of class \code{\Link{model.matrix}}.\end{Details}
\begin{Value}
For \code{data.frame(.)} a data frame, a matrix-like stucture whose
columns may be of differing types (numeric, factor and character).

\code{as.data.frame} is generic function with many methods.   It
attempts to coerce its argument to be a data frame.

\code{is.data.frame} returns \code{TRUE} if its argument is a data
frame and \code{FALSE} otherwise.

\code{row.names} can be used to set and retrieve the row names of a
data frame, similarly to \code{\Link{rownames}} for arrays (and
it is a generic function that calls \code{rownames} for an
array argument.\end{Value}
\begin{Note}\relax
In versions of \R{} prior to 1.4.0 (and in S3) logical columns were
converted to factors.\end{Note}
\begin{SeeAlso}\relax
\code{\Link{print.data.frame}},
\code{\Link{read.table}},
\code{\Link{Math.data.frame}} etc, about
\emph{Group} methods for \code{data.frame}s;
\code{\Link{make.names}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
L3 <- LETTERS[1:3]
str(d <- data.frame(cbind(x=1, y=1:10), fac=sample(L3, 10, repl=TRUE)))

## The same with automatic column names:
str(     data.frame(cbind(  1,   1:10),     sample(L3, 10, repl=TRUE)))
is.data.frame(d)

## do not convert to factor, using I() :
str(cbind(d, char = I(letters[1:10])), vec.len = 10)

stopifnot(1:10 == row.names(d))# {coercion}

(d0  <- d[, FALSE]) # NULL dataframe with 10 rows
(d.0 <- d[FALSE, ]) # <0 rows> dataframe  (3 cols)
(d00 <- d0[FALSE,])  # NULL dataframe with 0 rows

\end{ExampleCode}
\end{Examples}

