How to read all tables from a SQLite database and store as datasets/variables in R?

I have a large SQLite database with many tables. I have established a connection to this database in RStudio using RSQLite and DBI packages. (I have named this database db)


At the moment I have to read in all the tables and assign them a name manually. For example:

country <- dbReadTable(db, "country")
date <- dbReadTable(db, "date")
#...and so on

You can see this can be a very time-consuming process if you were to have many tables.

So I was wondering if it is possible to create a new function or using existing functions (e.g. lapply() ?) to complete this more efficiently and essentially speed up this process?

Any suggestions are much appreciated :)

Read more here:

Content Attribution

This content was originally published by Karima at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: