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]]

