aou_connect {allofus} | R Documentation |
Create a connection to the database in All of Us
Description
Connects to the All of Us database and returns a BigQueryConnection object. You can reference this object to query the database using R and or SQL code. A message is printed with the connection status (successful or not).
Usage
aou_connect(CDR = getOption("aou.default.cdr"), ...)
Arguments
CDR |
The name of the "curated data repository" to connect to. Defaults
to |
... |
Further arguments passed along to |
Details
You can reference this object to connect to the All of Us database
and run SQL code using, e.g., dbplyr
or DBI
. A message is printed with
the connection status (successful or not).
Value
A BigQueryConnection
object. This object is also saved as an option
(getOption("aou.default.con")
).
Examples
con <- aou_connect()
# reference the observation table in the database
dplyr::tbl(con, "observation")
# print a list of the tables in the database
DBI::dbListTables(con)