dimnames                package:base                R Documentation

_D_i_m_n_a_m_e_s _o_f _a_n _O_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     Retrieve or set the dimnames of an object.

_U_s_a_g_e:

     dimnames(x)
     dimnames(x) <- value

_A_r_g_u_m_e_n_t_s:

       x: an R object, for example a matrix, array or data frame.

   value: a possible value for 'dimnames(x)': see "Value".

_D_e_t_a_i_l_s:

     The functions 'dimnames' and 'dimnames<-' are generic.

     For an 'array' (and hence in particular, for a 'matrix'), they
     retrieve or set the 'dimnames' attribute (see attributes) of the
     object.  The list 'value' can have names, and these will be used
     to label the dimensions of the array where appropriate.

     Both have methods for data frames.  The dimnames of a data frame
     are its 'row.names' attribute and its 'names'.

     As from R 1.8.0 factor components of 'value' will be coerced to
     character.

_V_a_l_u_e:

     The dimnames of a matrix or array can be 'NULL' or a list of the
     same length as 'dim(x)'.  If a list, its components are either
     'NULL' or a character vector the length of the appropriate
     dimension of 'x'.

_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:

     'rownames', 'colnames'; 'array', 'matrix', 'data.frame'.

_E_x_a_m_p_l_e_s:

     ## simple versions of rownames and colnames
     ## could be defined as follows
     rownames0 <- function(x) dimnames(x)[[1]]
     colnames0 <- function(x) dimnames(x)[[2]]

