\HeaderA{assignOps}{Assignment Operators}{assignOps}
\aliasA{->}{assignOps}{.Rdash.>}
\aliasA{->{}>}{assignOps}{.Rdash.>.Rlbrace..Rrbrace.>}
\aliasA{<\Rdash}{assignOps}{<.Rdash.}
\aliasA{<{}<\Rdash}{assignOps}{<.Rlbrace..Rrbrace.<.Rdash.}
\aliasA{=}{assignOps}{=}
\keyword{data}{assignOps}
\begin{Description}\relax
Assign a value to a name.
\end{Description}
\begin{Usage}
\begin{verbatim}
x <- value
x <<- value
value -> x
value ->> x

x = value
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a variable name (possibly quoted).
\item[\code{value}] a value to be assigned to \code{x}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
There are three different assignment operators: two of them
have leftwards and rightwards forms.

The operators \code{<-} and \code{=} assign into the environment in
which they are evaluated.  The  operator\code{<-} can be used
anywhere, whereas the operator \code{=} is only allowed at the top
level (e.g., in the complete expression typed at the command prompt)
or as one of the subexpressions in a braced list of expressions.

The operators \code{<{}<-} and \code{->{}>} cause a search to made through
the environment for an existing definition of the variable being
assigned.  If such a variable is found (and its binding is not locked)
then its value is redefined, otherwise assignment takes place in the
global environment.  Note that their semantics differ from that in the
S language, but are useful in conjunction with the scoping rules of
\R.  See \sQuote{The R Language Definition} manual for further details
and examples.

In all the assignment operator expressions, \code{x} can be a name
or an expression defining a part of an object to be replaced (e.g.,
\code{z[[1]]}).  A syntactic name does not need to be quoted,
though it can be (preferably by \LinkA{backtick}{backtick}s).

The leftwards forms of assignment \code{<- = <{}<-} group right to left,
the other from left to right.
\end{Details}
\begin{Value}
\code{value}.  Thus one can use \code{a <- b <- c <- 6}.
\end{Value}
\begin{Note}\relax
Prior to \R{} 2.4.0 the base environment was ignored in the search for a
binding by \code{<{}<-} and \code{->{}>}.
\end{Note}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.

Chamber, J. M. (1998)
\emph{Programming with Data. A Guide to the S Language}.
Springer (for \code{=}).
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{assign}{assign}},
\code{\LinkA{environment}{environment}}.
\end{SeeAlso}

