\Header{dimnames}{Dimnames of an Object}
\methalias{dimnames.data.frame}{dimnames}
\alias{dimnames<\Rdash}{dimnames}
\methalias{dimnames<\Rdash.data.frame}{dimnames}
\keyword{array}{dimnames}
\keyword{manip}{dimnames}
\begin{Description}\relax
Retrieve or set the dimnames of an object.\end{Description}
\begin{Usage}
\begin{verbatim}
dimnames(x)
dimnames(x) <- nlist
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an \R{} object, for example a matrix, array or data frame.
\item[\code{nlist}] a list of the length \code{dim(x)} whose components
are either null or character vectors the length of the appropriate
dimension of \code{x}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The functions \code{dimnames} and \code{dimnames<-} are generic.

For an \code{\Link{array}} (and hence in particular, for a
\code{\Link{matrix}}), they retrieve or
set the \code{dimnames} attribute (see \link{attributes}) of the
object. The list \code{nlist} can have names, and these will be
used to label the dimensions of the array where appropriate.

Both have methods for data frames.  The dimnames of a data frame are
its \code{row.names} attribute and its \code{\Link{names}}.\end{Details}
\begin{SeeAlso}\relax
\code{\Link{rownames}}, \code{\Link{colnames}};
\code{\Link{array}}, \code{\Link{matrix}}, \code{\Link{data.frame}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## simple versions of rownames and colnames
## could be defined as follows
rownames0 <- function(x) dimnames(x)[[1]]
colnames0 <- function(x) dimnames(x)[[2]]
\end{ExampleCode}
\end{Examples}

