Skip to main content

builtin_expand_grid

Function builtin_expand_grid 

Source
fn builtin_expand_grid(
    args: &[RValue],
    named: &[(String, RValue)],
) -> Result<RValue, RError>
Expand description

Create a data frame from all combinations of the supplied vectors.

Each argument is a vector of values; the result is a data frame with one row for every combination. The first factor varies fastest, matching R’s expand.grid() semantics.

Uses itertools::multi_cartesian_product internally (with reversed input order so the first argument cycles fastest).

@param … vectors whose Cartesian product forms the rows @return data.frame with prod(lengths) rows