Skip to content

Instantly share code, notes, and snippets.

@randy3k
randy3k / combin.r
Last active November 30, 2017 18:43
# it is a tutorial to generate permuations/combinations using `partitions`, `gtools` and `multicool`.
# mainly for reference only, consider the package `iterpc` in practice.
library(partitions)
library(gtools)
library(multicool)
1) combinations: without replacement: distinct items
n = 5; r = 3
combn(n, r)