\Header{names}{The Names Attribute of an Object}
\methalias{names.default}{names}
\alias{names<\Rdash}{names}
\methalias{names<\Rdash.default}{names}
\keyword{attribute}{names}
\begin{Description}\relax
Functions to get or set the names of an object.\end{Description}
\begin{Usage}
\begin{verbatim}
names(x)
names(x) <- value
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an \R{} object.
\item[\code{value}] a character vector of the same length as \code{x}, or
\code{NULL}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{names} is a generic accessor function, and \code{names<-} is a
generic replacement function.  The default methods get and set
the \code{"names"} attribute of a vector or list.

It is possible to update just part of the names attribute via the
general rules: see the examples.  This works because the expression
there is evaluated as \code{z <- "names<-"(z, "[<-"(names(z), 3, "c2"))}.\end{Details}
\begin{Value}
For \code{names}, \code{NULL} or a character vector of the same length
as \code{x}.

For \code{names<-}, the updated object.  (Note that the value of
\code{names(x) <- value} is that of the assignment, \code{value}, not
the return value from the left-hand side.)\end{Value}
\begin{Examples}
\begin{ExampleCode}

# print the names attribute of the islands data set
names(islands)

# remove the names attribute
names(islands) <- NULL

z <- list(a=1, b="c", c=1:3)
names(z)
# change just the name of the third element.
names(z)[3] <- "c2"
z
\end{ExampleCode}
\end{Examples}

