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

