export_sqlite: Export to SQLite Database

Description Usage Arguments Value Examples

View source: R/export_sqlite.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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 Dec. 13, 2021, 10:11 a.m.