count                  package:Rlab                  R Documentation

_C_o_u_n_t_s _e_l_e_m_e_n_t_s _w_h_i_c_h _m_e_e_t _s_p_e_c_i_f_i_e_d _c_o_n_d_i_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     Count the number of times the values in the vector meet the
     specified conditions.

_U_s_a_g_e:

     count(x)

_A_r_g_u_m_e_n_t_s:

       x: Vector and condition to count. 

_S_e_e _A_l_s_o:

     length, nchar

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

     set.seed(1)
     x <- rnorm(100)

     # Count the number of times the values in x are greater then 0
     count( x>0 )

     # Count the number of times the values in x are within the 95
     count( (x>-1.96) & (x<1.96) )
     # Or could have used
     count( abs(x)<1.96 )

     # Count the number of times the values in x are the same as the first element
     count( x==x[1] )

