Skip to contents

generate all combinations

Usage

gen_combn(x, n = 2)

Arguments

x

vector

n

numbers of element to combine

Value

all combinations

Examples

gen_combn(1:4, n = 2)
#> [[1]]
#> [1] 1 2
#> 
#> [[2]]
#> [1] 1 3
#> 
#> [[3]]
#> [1] 1 4
#> 
#> [[4]]
#> [1] 2 3
#> 
#> [[5]]
#> [1] 2 4
#> 
#> [[6]]
#> [1] 3 4
#>