Learn R Programming

noncompliance (version 0.2.2)

expand.grid.DT: Expand.grid using the data.table package.

Description

Expand.grid (expand.grid) using the data.table package, with up to 4 supplied vectors.

Usage

expand.grid.DT(seq1, seq2, seq3 = NA, seq4 = NA, col.names = NA)

Arguments

seq1
Vector of values.
seq2
Vector of values.
seq3
Vector of values.
seq4
Vector of values.
col.names
Names of columns.

Value

A data.table with all possible combinations (Cartesian product) of the elements in the input vector sequences.

Examples

Run this code
expand.grid.DT(1:10, 100:110)
expand.grid.DT(1:10, 100:110, col.names=c("A", "B"))
expand.grid.DT(1:10, 100:110, 11:13, 1:2)

Run the code above in your browser using DataLab