DEV Community

loading...

R Language : Connect to SQLite database

maheshkay profile image Mahesh K Updated on ・1 min read

When you are developing scripts for R. You may get into scenarios where you have to access different type of databases.

SQLite being file level database, not a lot of people use it for big data storage or analysis specific storage. Then again there are some scenarios where you may get to access this database.

For example Android based apps and the services make use of the Sqlite more these days. And you may have to clean and read such data.

So here I want to show you how to connect to SQLite database using R programming language.

You can check out R language Connect to SQLite database tutorial for video instructions.

Here's the code example that you can check out. I am assuming that you are using RStudio for executing the code below.

library(RSQLite)

setwd("/sqlitedatafolder")
sqlite <- dbDriver("SQLite")
conn <- dbConnect(sqlite,"rlang_db.sqlite3")

This example basically connects you with the database. From here onwards you can run further queries and process the data and visualize depending on your requirement.

Discussion

pic
Editor guide