Learn R Programming

sqliter (version 0.1.0)

execute: execute query into a given database

Description

Once you have a sqliter database properly set you can execute queries into that database and get your data transformed. By default this function returns a data.frame object, but if you transform your data you can get whatever you need.

Usage

execute(object, ...)
"execute" (object, database, query, post_proc = identity, ...)

Arguments

object
sqliter object
database
the SQLite database filename without extension
query
the query string
post_proc
a function to transform data, it receives a database and returns whatever you need.
...
additional arguments used by prepared queries

Examples

Run this code
## Not run: 
# DBM <- sqliter(path=c("data", "another/project/data"))
# ds <- execute(DBM, "dummydatabase", "select count(*) from dummytable")
# ds <- execute(DBM, "dummydatabase", "select * from dummytable where
#       name = :name", name=c("Macunamima", "Borba Gato"))
# ds <- execute(DBM, "dummydatabase", "select * from dummytable where
#       name = :name", name=c("Macunamima", "Borba Gato"),
#         post_proc=function(ds) {
# ds <- transform(ds, birthday=as.Date(birthday))
# ds
# })
# ## End(Not run)

Run the code above in your browser using DataLab