Description Usage Arguments Value Examples
Loops over the last argument, then the second-last, and so on. It should be
faster than expand.grid
.
1 | expand_grid(..., together = NULL)
|
... |
Vectors you want all combinations of. |
together |
Data frame of vectors, where each row is a set of parameter values that are always kept together. |
Data table.
1 2 3 4 5 6 7 | # Simple example of expand.grid vs. expand_grid
expand.grid(x = c("a", "b", "c"), y = c(1, 2), z = c(TRUE, FALSE))
expand_grid(x = c("a", "b", "c"), y = c(1, 2), z = c(TRUE, FALSE))
# How to keep certain variables together
expand_grid(x = 1: 5,
together = data.frame(y = c("1a", "2a"), z = c("1b", "2b")))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.