aou_create_temp_table {allofus}R Documentation

Creates a temporary table from a local data frame or tibble

Description

Experimental function that builds a local tibble into an SQL query and generates a temporary table. Larger tables will be broken up into consequitive SQL queries; making nchar_batch smaller can avoid errors but will take longer. The table will only exist for the current connection session and will need to be created again in a new session.

Usage

aou_create_temp_table(
  data,
  nchar_batch = 1e+06,
  ...,
  con = getOption("aou.default.con")
)

Arguments

data

A local dataframe (or tibble)

nchar_batch

approximate number of characters to break up each SQL query

...

Not currently used

con

Connection to the allofus SQL database. Defaults to getOption("aou.default.con"), which is created automatically with aou_connect().

Details

[Experimental]

Value

a reference to a temporary table in the database with the data from df

Examples


con <- aou_connect()
df <- data.frame(
  concept_id = c(
    439331, 4290245, 42535816, 46269813,
    2784565, 45765502, 434112, 4128031, 435640, 45876808
  ),
  category = c(
    "AB", "DELIV", "DELIV", "SA", "DELIV",
    "LB", "DELIV", "DELIV", "PREG", "SA"
  ),
  gest_value = c(NA, NA, NA, NA, NA, NA, NA, NA, 25, NA)
)
tmp_tbl <- aou_create_temp_table(df)


[Package allofus version 1.1.0 Index]