Skip to contents

Create a data frame from all combinations of the supplied vectors, without considering repetitions.

Usage

expand_grid_unique(x, y, include_equals = FALSE)

Arguments

x

A vector

y

A vector

include_equals

A boolean value, if TRUE the function will ignore the equal pairs (default = FALSE)

Value

A tibble with all the combinations of x and y.

Examples


expand_grid_unique(x = 1:3,y = 1:3)
#> # A tibble: 3 × 2
#>      V1    V2
#>   <int> <int>
#> 1     1     2
#> 2     1     3
#> 3     2     3

expand_grid_unique(x = 1:3,y = 1:3,include_equals = TRUE)
#> # A tibble: 6 × 2
#>      V1    V2
#>   <int> <int>
#> 1     1     1
#> 2     1     2
#> 3     1     3
#> 4     2     2
#> 5     2     3
#> 6     3     3