Search notes:

R function: expand.grid

expand.grid creates the cartesian product of factors. In SQL, that would be a cross join.
a <- c( 1, 2, 3)
b <- c( 4, 5, 6)
c <- c( 7, 8, 9)

expand.grid(a, b, c)
#    Var1 Var2 Var3
# 1     1    4    7
# 2     2    4    7
# 3     3    4    7
# 4     1    5    7
# 5     2    5    7
# 6     3    5    7
# 7     1    6    7
# 8     2    6    7
# 9     3    6    7
# 10    1    4    8
# 11    2    4    8
# 12    3    4    8
# 13    1    5    8
# 14    2    5    8
# 15    3    5    8
# 16    1    6    8
# 17    2    6    8
# 18    3    6    8
# 19    1    4    9
# 20    2    4    9
# 21    3    4    9
# 22    1    5    9
# 23    2    5    9
# 24    3    5    9
# 25    1    6    9
# 26    2    6    9
# 27    3    6    9

typeof(expand.grid(a, b, c))
# [1] "list"
cat("\n\n")

expand.grid(col_1 = 1:2, col_2 = c('Foo', 'Bar', 'Baz'))
#   col_1 col_2
# 1     1   Foo
# 2     2   Foo
# 3     1   Bar
# 4     2   Bar
# 5     1   Baz
# 6     2   Baz
Github repository about-r, path: /functions/expand.grid.R

See also

Index to (some) R functions

Index