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)

_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

