Learn R Programming

ffbase (version 0.13.3)

expand.ffgrid: Create a ffdf from All Combinations of Factors

Description

Similar as expand.grid in the base package generates an ffdf. Code is almost copy-pasted from expand.grid.

Usage

expand.ffgrid(..., KEEP.OUT.ATTRS = TRUE, stringsAsFactors = TRUE)

Arguments

...

ff vectors, ff factors or a list containing these.

KEEP.OUT.ATTRS

currently ignored

stringsAsFactors

logical specifying if character vectors are converted to factors. Irrelevant for ff as character vectors are factors in package ff.

Value

A ffdf containing one row for each combination of the supplied factors. The first factors vary fastest. The columns are labelled by the factors if these are supplied as named arguments or named components of a list.

See Also

expand.grid

Examples

Run this code
# NOT RUN {
comb <- expand.ffgrid(ff(1:1000), ff(factor(LETTERS)))
dim(comb)

x <- ff(factor(LETTERS))
y <- ff(1:1000)
z <- ff(seq.Date(Sys.Date(), Sys.Date()+10, by = "day"))
comb <- expand.ffgrid(x, y, z)
dim(comb)
comb[1:100, ]

expand.ffgrid(list(a = ff(1:10), b = ff(1:10)))

# }

Run the code above in your browser using DataLab