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'. _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 ('ncol' and 'nrow'.) _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