

col {base}                                   R Documentation

_C_o_l_u_m_n _I_n_d_e_x_e_s

_U_s_a_g_e_:

     col(x, as.factor=FALSE)

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

       x: a matrix.

as.factor: a logical value indicating whether the value
          should be returned as a factor rather than as
          numeric.

_V_a_l_u_e_:

     An integer matrix with the same dimensions as `x' and
     whose `ij'-th element is equal to `j'.

_S_e_e _A_l_s_o_:

     `row' to get rows.

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

     # extract an off-diagonal of a matrix
     ma <- matrix(1:12, 3,4)
     ma[row(ma)==col(ma) + 1]

     # create an identity 5-by-5 matrix
     x <- matrix(0,nr=5,nc=5)
     x[row(x)==col(x)] <- 1

