

row/colnames {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

_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 `dim-
     names(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

