load_db: Load schemas from a ukbschemas SQLite database

Description Usage Arguments Details Value Examples

View source: R/load-db.R

Description

load_db() is a simple front-end to DBI functions which can be used to load tables from a ukbschemas database (or in fact, any database; see DBI::DBI-package).

Usage

1
load_db(file = NULL, db = NULL)

Arguments

file

Full path to an SQLite database, or NULL.

db

A (possibly disconnected) database connection, or NULL.

Details

load_db() will attempt to open an SQLite database from file file or from connection db. It will throw errors if the file is not a valid databse or it is impossible to create a valid connection from db. Tables are read with DBI::dbReadTable and converted to data frames of class tbl_df (see tibble::tibble). The database connection is always closed before the function returns its result.

Value

A named list with elements of class tbl_df, containing the tables from db.

Examples

1
2
3
4
5
## Not run: 
db <- ukbschemas_db(path = tempdir())
sch <- load_db(db = db)

## End(Not run)

bjcairns/ukbschemas documentation built on Nov. 4, 2019, 7:22 a.m.