crossing()
is similar to expand_grid()
but de-duplicates and sorts its inputs.
crossing(..., .name_repair = "check_unique")
Variables to get unique combinations of
Treatment of problematic names. See ?vctrs::vec_as_names
for options/details
x <- 1:2
y <- 1:2
crossing(x, y)
#> # A tidytable: 4 × 2
#> x y
#> <int> <int>
#> 1 1 1
#> 2 1 2
#> 3 2 1
#> 4 2 2
crossing(stuff = x, y)
#> # A tidytable: 4 × 2
#> stuff y
#> <int> <int>
#> 1 1 1
#> 2 1 2
#> 3 2 1
#> 4 2 2