# NOT RUN {
# choose 2 from 4
combinations(4, 2)
combinations(LETTERS[1:3], k = 2)
# multiset with frequencies c(2, 3)
combinations(k = 3, freq = c(2, 3))
# with replacement
combinations(4, 2, replace = TRUE)
# column major
combinations(4, 2, layout = "column")
# list output
combinations(4, 2, layout = "list")
# specifc range of combinations
combinations(4, 2, nitem = 2, skip = 3)
# specific combinations
combinations(4, 2, index = c(3, 5))
# random combinations
combinations(4, 2, nsample = 3)
# zero sized combinations
dim(combinations(5, 0))
dim(combinations(5, 6))
dim(combinations(0, 0))
dim(combinations(0, 1))
# }
Run the code above in your browser using DataLab