names                  package:base                  R Documentation

_T_h_e _N_a_m_e_s _A_t_t_r_i_b_u_t_e _o_f _a_n _O_b_j_e_c_t

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

     Functions to get or set the names of an object.

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

     names(x, ...)
     names(x) <- value

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

       x: an R object.

   value: a character vector of the same length as `x', or `NULL'.

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

     For `names', `NULL' or a character vector of the same length as
     `x'.

     For `names<-', the updated object.  (Note that the value of
     `names(x) <- value' is that of the assignment, `value', not the
     return value from the left-hand side.)

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

     # print the names attribute of the islands data set
     names(islands)

     # remove the names attribute
     names(islands) <- NULL

     z <- list(a=1, b="c", c=1:3)
     names(z)
     # change just the name of the third element.
     names(z)[3] <- "c2"
     z

