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

