Rev 27118 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{assignOps}\alias{<-}\alias{=}\alias{<<-}\alias{->}\alias{->>}\title{Assignment Operators}\description{Assign a value to a name.}\usage{x <- valuex <<- valuevalue -> xvalue ->> xx = value}\arguments{\item{x}{a variable name (possibly quoted).}\item{value}{a value to be assigned to \code{x}.}}\details{There are three different assignment operators: two of themhave leftwards and rightwards forms.The operators \code{<-} and \code{=} assign into theenvironment in which they are evaluated. The \code{<-} can be usedanywhere, but the \code{=} is only allowed at the top level (thatis, in the complete expression typed by the user) or as one of thesubexpressions in a braced list of expressions.The operators \code{<<-} and \code{->>} cause a search to made throughthe environment for an existing definition of the variable beingassigned. If such a variable is found then its value is redefined,otherwise assignment takes place globally. Note that their semanticsdiffer from that in the S language, but are useful in conjunction withthe scoping rules of \R.In all the assignment operator expressions, \code{x} can be a nameor an expression defining a part of an object to be replaced (e.g.,\code{z[[1]]}). The name does not need to be quoted, though it canbe.The leftwards forms of assignment \code{<- = <<-} group right to left,the other from left to right.}\value{\code{value}. Thus one can use \code{a <- b <- c <- 6}.}\references{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{=}).}\seealso{\code{\link{assign}},\code{\link{environment}}.}\keyword{data}