combn                package:combinat                R Documentation

_G_e_n_e_r_a_t_e _a_l_l _c_o_m_b_i_n_a_t_i_o_n_s _o_f _t_h_e _e_l_e_m_e_n_t_s _o_f _x _t_a_k_e_n _m _a_t _a _t_i_m_e.

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

     Generate all combinations of the elements of x taken m at a time.
     If x is a positive integer,  returns all combinations of the
     elements of seq(x) taken m at a time. If argument "fun" is not
     null,  applies a function given by the argument to each point.  If
     simplify is FALSE,  returns a list; else returns a vector or an
     array.  "..." are passed unchanged to function given by argument
     fun,  if any.

     combn2:Generate all combinations of the elements of x taken two at
     a time. If x is missing,  generate all combinations of 1:n taken
     two at a time (that is,  the indices of x that would give all
     combinations of the elements of x if x with length n had been
     given). Exactly one of arguments "x" and "n" should be given; no
     provisions for function evaluation.

     nCm: Compute the binomial coefficient ("n choose m"),  where n is
     any real number and m is any integer.  Arguments n and m may be
     vectors; they will be replicated as necessary to have the same
     length. Argument tol controls rounding of results to integers.  If
     the difference between a value and its nearest integer is less
     than tol, the value returned will be rounded to its nearest
     integer.  To turn off rounding, use tol = 0.  Values of tol
     greater than the default should be used only with great caution,
     unless you are certain only integer values should be returned.

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

     combn(x, m, fun=NULL, simplify=TRUE, ...)

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

       x: vector source for combinations 

       m: number of elements 

     fun: function to be applied to each combination (may be null) 

simplify: logical, if FALSE, returns a list, otherwise returns vector
          or array 

     ...: args to fun 

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

     Nijenhuis, A. and Wilf, H.S. (1978) Combinatorial Algorithms for
     Computers and Calculators.  NY:  Academic Press.

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

     see simplify argument

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

     Code by Scott Chasalow, R package and doc prep by Vince Carey,
     stvjc@channing.harvard.edu

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

     ~put references to the literature/web site here ~

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

      combn(letters[1:4], 2)
      combn(10, 5, min)  # minimum value in each combination
     # Different way of encoding points:
      combn(c(1,1,1,1,2,2,2,3,3,4), 3, tabulate, nbins = 4)
     #Compute support points and (scaled) probabilities for a
     #Multivariate-Hypergeometric(n = 3, N = c(4,3,2,1)) p.f.:
     # table.mat(t(combn(c(1,1,1,1,2,2,2,3,3,4), 3, tabulate,nbins=4)))

