memdb_frame() works like tibble::tibble(), but instead of creating a new data frame in R, it creates a table in src_memdb().

memdb_frame(..., .name = unique_table_name())

tbl_memdb(df, name = deparse(substitute(df)))

src_memdb()

Arguments

...

<dynamic-dots> A set of name-value pairs. These arguments are processed with rlang::quos() and support unquote via !! and unquote-splice via !!!. Use := to create columns that start with a dot.

Arguments are evaluated sequentially. You can refer to previously created elements directly or using the .data pronoun. An existing .data pronoun, provided e.g. inside dplyr::mutate(), is not available.

df

Data frame to copy

name, .name

Name of table in database: defaults to a random name that's unlikely to conflict with an existing table.

Examples

library(dplyr) df <- memdb_frame(x = runif(100), y = runif(100)) df %>% arrange(x)
#> # Source: table<dbplyr_022> [?? x 2] #> # Database: sqlite 3.34.1 [:memory:] #> # Ordered by: x #> x y #> <dbl> <dbl> #> 1 0.00842 0.435 #> 2 0.0202 0.208 #> 3 0.0215 0.481 #> 4 0.0228 0.645 #> 5 0.0251 0.345 #> 6 0.0361 0.0883 #> 7 0.0601 0.520 #> 8 0.0617 0.709 #> 9 0.0646 0.469 #> 10 0.0654 0.151 #> # … with more rows
df %>% arrange(x) %>% show_query()
#> <SQL> #> SELECT * #> FROM `dbplyr_022` #> ORDER BY `x`
mtcars_db <- tbl_memdb(mtcars) mtcars_db %>% group_by(cyl) %>% summarise(n = n()) %>% show_query()
#> <SQL> #> SELECT `cyl`, COUNT(*) AS `n` #> FROM `mtcars` #> GROUP BY `cyl`