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 = random_table_name())

src_memdb()

Arguments

...

A set of name-value pairs. Arguments are evaluated sequentially, so you can refer to previously created variables.

.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))
#> Auto-disconnecting PostgreSQLConnection
df %>% arrange(x)
#> Source: table<guhwhzptvt> [?? x 2] #> Database: sqlite 3.11.1 [:memory:] #> Ordered by: x #> #> # S3: tbl_dbi #> x y #> <dbl> <dbl> #> 1 0.02006522 0.750603328 #> 2 0.02795603 0.383370670 #> 3 0.02806097 0.004496308 #> 4 0.03123033 0.164569248 #> 5 0.03424133 0.011479538 #> 6 0.05144628 0.402881212 #> # ... with more rows
df %>% arrange(x) %>% show_query()
#> <SQL> #> SELECT * #> FROM `guhwhzptvt` #> ORDER BY `x`