subsets                 package:BHH2                 R Documentation

_G_e_n_e_r_a_t_i_o_n _o_f _a_l_l _t_h_e _c_o_m_b_i_n_a_t_i_o_n_s _o_f _k _e_l_e_m_e_n_t_s _f_r_o_m _n _p_o_s_s_i_b_l_e

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

     Generates all different subsets of size r chosen from n different
     elements.

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

     subsets(n, r, v = 1:n)

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

       n: numeric. Number of elements to choose from.

       r: numeric. Size of the subsets.

       v: vector. Numeric or character vector of size 'n' with the
          labels of the n elements to choose from.

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

     A matrix of dimension (N x r), where N is the total number of
     different combinations of r elements chosen from n possible.

_N_o_t_e:

     This particular version of the function was taken from a message
     from Bill Venables to 'r-help' list on Sun, 17 Dec 2000.

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

     Bill Venables Bill.Venables@cmis.csiro.au

_R_e_f_e_r_e_n_c_e_s:

     Venables, Bill. "Programmers Note", R-News, Vol 1/1, Jan. 2001.
     <URL: http://cran.r-project.org/doc/Rnews>

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

     'combinations' of the 'gtools' package.

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

     library(BHH2)
     subsets(5,3)
     subsets(5,3,letters)
     subsets(5,3,c(10,20,30,50,80))

