export_sqlite: Export to SQLite Database

View source: R/export_sqlite.R

export_sqliteR Documentation

Export to SQLite Database

Description

Add a list of instrument dataframes from split_instruments() to an RSQLite database, if you want to use SQL commands that way. This is really just a wrapper for lapply to add all the instruments at once.

Usage

export_sqlite(conn, instrument_list, ...)

Arguments

conn

A database connection from RSQLite::dbConnect()

instrument_list

A list of instruments, either from split_instruments() or query_subjects() (but you probably want the full data from the former)

...

Other options to pass to dbWriteTable

Value

Nothing, will display a message if successful

Examples


# Set up instruments and database
# all_instruments <- split_instruments(report, lookup)
# db_con <- RSQLite::dbConnect(RSQLite::SQLite(), ":memory:")

# Send all instruments to database connection
# export_sqlite(db_con, all_instruments)

# Run a simple query
# RSQLite::dbGetQuery(dbcon, "SELECT
#                              wab.*,
#                              wabsum.aq
#                            FROM wab
#                            LEFT JOIN wabsum
#                            USING (record_id, redcap_repeat_instance)")

tsostarics/anrlab documentation built on Nov. 6, 2022, 3:54 a.m.