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:

     If the argument is not a 'factor', 'NA' is returned.

     The actual factor levels (if they exist) can be obtained with the
     'levels' function.

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

     nlevels(gl(3,7)) # = 3

