quantcut               package:gtools               R Documentation

_C_r_e_a_t_e _a _F_a_c_t_o_r _V_a_r_i_a_b_l_e _U_s_i_n_g _t_h_e _Q_u_a_n_t_i_l_e_s _o_f _a _C_o_n_t_i_n_u_o_u_s _V_a_r_i_a_b_l_e

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

     Create a factor variable using the quantiles of a continous
     variable.

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

     quantcut(x, q=c(0, 1/4, 2/4, 3/4, 4/4), na.rm=TRUE, include.lowest=TRUE, ...)

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

       x: Continous variable. 

       q: Vector of quantiles used for creating groups. Defaults to
          'c(0, 1/4, 2/4, 3/4, 4/4)'.  See 'quantile' for details. 

   na.rm: Boolean indicating whether missing values should be removed
          when computing quantiles.  Defaults to TRUE.

include.lowest: Boolean indicating whether values exactly equal to the
          lowest specified quantile be included in the lowest group. 
          See 'cut' for details. 

     ...: Optional arguments passed to 'cut'. 

_D_e_t_a_i_l_s:

     This function is simply a uses 'quantile' to obtaine the quantiles
     of 'x', then calls 'cut' to create a factor variable using the
     quantiles for cut points.

_V_a_l_u_e:

     Factor variable with one level for each quantile interval given by
     'q'.

_A_u_t_h_o_r(_s):

     Gregory R. Warnes Gregory_R_Warnes@groton.pfizer.com

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

     'cut', 'quantile'

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

       x <- rnorm(1000)
       quants <- quantcut( x )
       table(quants)

