row/colnames              package:base              R Documentation

_R_o_w _a_n_d _C_o_l_u_m_n_n _N_a_m_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Retrieve or set the row or column names of an object (the first or
     second component of its `dimnames').

_U_s_a_g_e:

     rownames(x, do.NULL = TRUE, prefix = "row")
     rownames(x) <- namevector

     colnames(x, do.NULL = TRUE, prefix = "col")
     colnames(x) <- namevector

_A_r_g_u_m_e_n_t_s:

       x: 

 do.NULL: logical. Should this create names if they are `NULL'?

  prefix: for created names.

_D_e_t_a_i_l_s:

     If `do.NULL' is `FALSE', a character vector (of length `NROW(x)'
     or `NCOL(x)' is returned in any case, prepending `prefix' to
     simple numbers, if `dimnames(x)[[i]]' (`i =' 1 or 2) is `NULL'.

_S_e_e _A_l_s_o:

     `dimnames', `case.names', `variable.names'.

_E_x_a_m_p_l_e_s:

     m0 <- matrix(NA, 4, 0)
     m2 <- cbind(1,1:4)
     rownames(m0)

     colnames(m2, do.NULL = FALSE)
     colnames(m2) <- c("x","Y")
     rownames(m2) <- rownames(m2, do.NULL = FALSE, prefix = "Obs.")
     m2

