Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Working on big data requires a clean and robust approach on storing and accessing the data. SQLite is an all inclusive server-less database system in a single file. This is very convenient for data exchange between colleagues. Here is a workflow of SQLite data accessing and data storing in R.

Connect to an SQLite database file and get a table directly to a data.frame data-type. Useful when handling big chunks of data or when analyzing subsets of data which can be retrieved via an SQLite query.

 Source code
library("RSQLite")# connect to the sqlite filecon = dbConnect(drv="SQLite", dbname="country.sqlite")# get a list of all tablesalltables = dbListTables(con)# get the populationtable as a data.framep1 = dbGetQuery( con,'select * from populationtable' )# count the areas in the SQLite tablep2 = dbGetQuery( con,'select count(*) from areastable' )# find entries of the DB from the last weekp3 = dbGetQuery(con, "SELECT population WHERE DATE(timeStamp) < DATE('now', 'weekday 0', '-7 days')")#Clear the results of the last querydbClearResult(p3)#Select population with managerial type of jobp4 = dbGetQuery(con, "select * from populationtable where jobdescription like '%manager%'")