Usage of S3 and R6 functions

Although rocker is a R6 class, functions can be also accesses in classical S3 way.

S3 example

library(rocker)
db <- newDB()
setupDriver(db, drv = RSQLite::SQLite(), dbname = ":memory:")
connect(db)
writeTable(db, "mtcars", mtcars)
sendQuery(db, "SELECT * FROM mtcars;")
output <- fetch(db)
clearResult(db)
disconnect(db)
unloadDriver(db)

R6 example

db <- rocker::newDB()
db$setupDriver(drv = RSQLite::SQLite(), dbname = ":memory:")
db$connect()
db$writeTable("mtcars", mtcars)
db$sendQuery("SELECT * FROM mtcars;")
output <- db$fetch()
db$clearResult()
db$disconnect()
db$unloadDriver()


Try the rocker package in your browser

Any scripts or data that you put into this service are public.

rocker documentation built on Aug. 21, 2022, 1:06 a.m.