Learn R Programming

optiRum (version 0.35)

CJ.dt: Cross join two data.tables

Description

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.

Usage

CJ.dt(X, Y)

Arguments

X
A data.table
Y
A data.table

Value

  • dt A data.table

See Also

Other helper: convertToXML; generatePDF; sanitise; wordwrap

Examples

Run this code
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)

Run the code above in your browser using DataLab