assignOps                package:base                R Documentation

_A_s_s_i_g_n_m_e_n_t _O_p_e_r_a_t_o_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     Assign a value to a name.

_U_s_a_g_e:

     x <- value
     x <<- value
     value -> x
     value ->> x

     x = value

_A_r_g_u_m_e_n_t_s:

       x: a variable name (possibly quoted).

   value: a value to be assigned to 'x'.

_D_e_t_a_i_l_s:

     There are three different assignment operators: two of them have
     leftwards and rightwards forms.

     The operators '<-' and '=' assign into the environment in which
     they are evaluated.  The  operator '<-' can be used anywhere,
     whereas the operator '=' 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 '<<-' and '->>' 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 'The R Language Definition' manual
     for further details and examples.

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

     The leftwards forms of assignment '<- = <<-' group right to left,
     the other from left to right.

_V_a_l_u_e:

     'value'.  Thus one can use 'a <- b <- c <- 6'.

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

     Chamber, J. M. (1998) _Programming with Data. A Guide to the S
     Language_. Springer (for '=').

_S_e_e _A_l_s_o:

     'assign', 'environment'.

