The package data.table has a CJ() function which produces a data.table out of two vectors. This function does the Cartesian product of two data.tables instead.

CJ.dt(X, Y)

Arguments

X

A data.table

Y

A data.table

Value

dt A data.table

See also

Examples

library(data.table) a <- data.table(a=1:2, b=letters[1:2]) b <- data.table(c=3:4, d=letters[3:4]) ab <- CJ.dt(a,b)