name                  package:base                  R Documentation

_N_a_m_e_s _a_n_d _S_y_m_b_o_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     A 'name' (also known as a 'symbol') is a way to refer to R objects
     by name (rather than the value of the object, if any, bound to
     that name).

     'as.name' and 'as.symbol' are identical: they attempt to coerce
     the argument to a name.

     'is.symbol' and the identical 'is.name' return 'TRUE' or 'FALSE'
     depending on whether the argument is a name or not.

_U_s_a_g_e:

     as.symbol(x)
     is.symbol(x)

     as.name(x)
     is.name(x)

_A_r_g_u_m_e_n_t_s:

       x: object to be coerced or tested.

_D_e_t_a_i_l_s:

     'as.name' first coerces its argument internally to a character
     vector (so methods for 'as.character' are not used).  It then
     takes the first element and provided it is not '""', returns a
     symbol of that name (and if the element is 'NA_character_', the
     name is '`NA`'. 

     'as.name' is implemented as 'as.vector(x, "symbol")', and hence
     will dispatch methods for the generic function 'as.vector'.

_V_a_l_u_e:

     For 'as.name' and 'as.symbol', an R object of type '"symbol"' (see
     'typeof').

     For 'is.name' and 'is.symbol', a length-one logical vector with
     value 'TRUE' or 'FALSE'.

_N_o_t_e:

     The term 'symbol' is from the LISP background of R, whereas 'name'
     has been the standard S term for this.

_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.

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

     'call', 'is.language'. For the internal object mode, 'typeof'.

     'plotmath' for another use of 'symbol'.

_E_x_a_m_p_l_e_s:

     an <- as.name("arrg")
     is.name(an) # TRUE
     mode(an)   # name
     typeof(an) # symbol

