View source: R/complete_design.R
expand_grid | R Documentation |
Cross product vectors in database.
expand_grid(
db,
values,
...,
temporary = TRUE,
table_name = (wrapr::mk_tmp_name_source("eg"))(),
qualifiers = NULL
)
db |
database handle |
values |
named list of value vectors. |
... |
force later arguments to bind by name. |
temporary |
logical if TRUE try to make temporary table. |
table_name |
name to land result as. |
qualifiers |
optional named ordered vector of strings carrying additional db hierarchy terms, such as schema. |
table handle.
if (requireNamespace("DBI", quietly = TRUE) &&
requireNamespace("RSQLite", quietly = TRUE)) {
my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
values <- list(nums = 1:3, lets = c("a", "b"))
res <- expand_grid(my_db, values)
print(res)
execute(my_db, res)
DBI::dbDisconnect(my_db)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.