\Header{mode}{The (Storage) Mode of an Object}
\alias{mode$\leftarrow $}{mode}
\alias{storage.mode}{mode}
\alias{storage.mode$\leftarrow $}{mode}
\keyword{attribute}{mode}
\begin{Usage}
\begin{verbatim}
mode(x)
mode(x) <- "<mode>"
storage.mode(x)
storage.mode(x) <- "<mode>"
\end{verbatim}
\end{Usage}
\begin{Description}
\texttt{mode} and \texttt{storage.mode} provide means of determining the
type or storage mode of an object.  Both return a character string
giving the (storage) mode of the object -- often the same -- both
relying on the output of \texttt{\Link{typeof}(x)}, see the example
below.

The two assignment versions are currently identical.  Both
\texttt{mode(x) <- newmode} and \texttt{storage.mode(x) <- newmode} change
the \texttt{mode} or \texttt{storage.mode} of object \texttt{x} to
\texttt{newmode}.\end{Description}
\begin{SeeAlso}
\texttt{\Link{typeof}} for the R-internal ``mode'',
\texttt{\Link{attributes}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
sapply(options(),mode)

cex3 <- c("NULL","1","1:1","1i","list(1)","data.frame(x=1)", "pairlist(pi)",
  "args", "lm", "formals(lm)[[1]]",  "formals(lm)[[2]]",
  "y~x","(y~x)[[1]]", "expression(x <- pi)[[1]][[1]]")
lex3 <- sapply(cex3, function(x) eval(parse(text=x)))
mex3 <- t(sapply(lex3, function(x) c(typeof(x), storage.mode(x), mode(x))))
dimnames(mex3) <- list(cex3, c("typeof(.)","storage.mode(.)","mode(.)"))
mex3

## This also makes a local copy of  `pi':
storage.mode(pi) <- "complex"
storage.mode(pi)
rm(pi)
\end{ExampleCode}
\end{Examples}

