expand_grid: Cross product vectors in database.

View source: R/complete_design.R

expand_gridR Documentation

Cross product vectors in database.

Description

Cross product vectors in database.

Usage

expand_grid(
  db,
  values,
  ...,
  temporary = TRUE,
  table_name = (wrapr::mk_tmp_name_source("eg"))(),
  qualifiers = NULL
)

Arguments

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.

Value

table handle.

Examples


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)
}


rquery documentation built on Aug. 20, 2023, 9:06 a.m.