nlevels package:base R Documentation _T_h_e _N_u_m_b_e_r _o_f _L_e_v_e_l_s _o_f _a _F_a_c_t_o_r _D_e_s_c_r_i_p_t_i_o_n: Return the number of levels which its argument has. _U_s_a_g_e: nlevels(x) _A_r_g_u_m_e_n_t_s: x: an object, usually a factor. _D_e_t_a_i_l_s: This is usually applied to a factor, but other objects can have levels. The actual factor levels (if they exist) can be obtained with the 'levels' function. _V_a_l_u_e: The length of 'levels(x)', which is zero if 'x' has no levels. _S_e_e _A_l_s_o: 'levels', 'factor'. _E_x_a_m_p_l_e_s: nlevels(gl(3,7)) # = 3