var_grid {nuggets} | R Documentation |
Create a tibble of combinations of xvar/yvar variable pairs.
Description
The function creates a tibble with two columns, xvar
and yvar
, whose
rows enumerate all combinations of column names specified in the xvars
and yvars
argument. The column names to create the combinations from are
specified using a tidyselect expression (see
tidyselect syntax).
Usage
var_grid(x, xvars = everything(), yvars = everything())
Arguments
x |
either a data frame or a matrix |
xvars |
a tidyselect expression (see
tidyselect syntax)
specifying the columns of |
yvars |
a tidyselect expression (see
tidyselect syntax)
specifying the columns of |
Value
a tibble with two columns (xvar
and yvar
) with rows enumerating
all combinations of column names specified by tidyselect expressions
in xvars
and yvars
arguments.
Author(s)
Michal Burda
Examples
var_grid(CO2)
var_grid(CO2, xvars = Plant:Treatment, yvars = conc:uptake)