nrow                  package:base                  R Documentation

_T_h_e _N_u_m_b_e_r _o_f _R_o_w_s/_C_o_l_u_m_n_s _o_f _a_n _A_r_r_a_y

_D_e_s_c_r_i_p_t_i_o_n:

     `nrow' and `ncol' return the number of rows or columns present in
     `x'. `NCOL' and `NROW' do the same treating a vector as 1-column
     matrix.

_U_s_a_g_e:

     nrow(x)
     ncol(x)
     NCOL(x)
     NROW(x)

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

       x: a vector, array or data frame

_V_a_l_u_e:

     an `integer' of length 1 or `NULL'.

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

     `dim' which returns all dimensions; `array', `matrix'.

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

     ma <- matrix(1:12, 3, 4)
     nrow(ma)   # 3
     ncol(ma)   # 4

     ncol(array(1:24, dim = 2:4)) # 3, the second dimension
     NCOL(1:12) # 1
     NROW(1:12) # 12

