# WARNING: example tries to change rquery.rquery_db_executor option to RSQLite and back.
if (requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE)) {
my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
old_o <- options(list("rquery.rquery_db_executor" = list(db = my_db)))
d <- rq_copy_to(my_db, 'd',
data.frame(AUC = 0.6, R2 = 0.2))
optree <- extend_se(d, c("v" %:=% "AUC + R2", "x" %:=% "pmax(AUC,v)"))
print(optree)
cat(format(optree))
v <- execute(my_db, optree)
print(v)
v2 <- execute(data.frame(AUC = 1, R2 = 2), optree)
print(v2)
options(old_o)
DBI::dbDisconnect(my_db)
}
Run the code above in your browser using DataLab