Hands-On Exploratory Data Analysis with R
上QQ阅读APP看书,第一时间看更新

Importing data into R from relational databases using the DBI R package

Database Independent Interface (DBI) makes connecting to and getting data from various relational databases from R very easy and efficient.

To use DBI, we load DBI first:

library(DBI)

We then create an in-memory RSQLite database:

con <- dbConnect(RSQLite::SQLite(), dbname = ":memory:")

We can print a list of tables as follows:

dbListTables(con)