Create a data.table from all combinations of inputs

expand_grid(..., .name_repair = "check_unique")

Arguments

...

Variables to get combinations of

.name_repair

Treatment of problematic names. See ?vctrs::vec_as_names for options/details

Examples

x <- 1:2
y <- 1:2

expand_grid(x, y)
#> # A tidytable: 4 × 2
#>       x     y
#>   <int> <int>
#> 1     1     1
#> 2     1     2
#> 3     2     1
#> 4     2     2

expand_grid(stuff = x, y)
#> # A tidytable: 4 × 2
#>   stuff     y
#>   <int> <int>
#> 1     1     1
#> 2     1     2
#> 3     2     1
#> 4     2     2