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 `<-' can be used anywhere, but the `=' is
     only allowed at the top level (that is, in the complete expression
     typed by the user) 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 then its value is
     redefined, otherwise assignment takes place globally. Note that
     their semantics differ from that in the S language, but is useful
     in conjunction with the scoping rules of R.

     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]]').  The name does not need to be quoted, though it can be.

     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'.

_S_e_e _A_l_s_o:

     `assign', `environment'.

