The R Project SVN R

Rev

Rev 61160 | Rev 65999 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61160 Rev 61168
Line 38... Line 38...
38
  \item{\dots}{optionally, further arguments to \code{FUN}.}
38
  \item{\dots}{optionally, further arguments to \code{FUN}.}
39
}
39
}
40
\value{
40
\value{
41
  a \code{\link{list}} or \code{\link{array}}, see the \code{simplify}
41
  a \code{\link{list}} or \code{\link{array}}, see the \code{simplify}
42
  argument above.  In the latter case, the identity
42
  argument above.  In the latter case, the identity
43
  \code{dim(combn(n,m)) == c(m, choose(n,m))} holds.
43
  \code{dim(combn(n, m)) == c(m, choose(n, m))} holds.
44
}
44
}
45
\references{
45
\references{
46
  Nijenhuis, A. and Wilf, H.S. (1978)
46
  Nijenhuis, A. and Wilf, H.S. (1978)
47
  \emph{Combinatorial Algorithms for Computers and Calculators};
47
  \emph{Combinatorial Algorithms for Computers and Calculators};
48
  Academic Press, NY.
48
  Academic Press, NY.
Line 59... Line 59...
59
  all combinations of factors or vectors.
59
  all combinations of factors or vectors.
60
}
60
}
61
\examples{
61
\examples{
62
combn(letters[1:4], 2)
62
combn(letters[1:4], 2)
63
(m <- combn(10, 5, min))   # minimum value in each combination
63
(m <- combn(10, 5, min))   # minimum value in each combination
64
mm <- combn(15, 6, function(x) matrix(x, 2,3))
64
mm <- combn(15, 6, function(x) matrix(x, 2, 3))
65
stopifnot(round(choose(10,5)) == length(m),
65
stopifnot(round(choose(10, 5)) == length(m),
66
          c(2,3, round(choose(15,6))) == dim(mm))
66
          c(2,3, round(choose(15, 6))) == dim(mm))
67
 
67
 
68
## Different way of encoding points:
68
## Different way of encoding points:
69
combn(c(1,1,1,1,2,2,2,3,3,4), 3, tabulate, nbins = 4)
69
combn(c(1,1,1,1,2,2,2,3,3,4), 3, tabulate, nbins = 4)
70
 
70
 
71
## Compute support points and (scaled) probabilities for a
71
## Compute support points and (scaled) probabilities for a