order_expr() uses bquote() .()-style escaping.
order_expr(source, expr, env = parent.frame())order_expr_nse(source, expr, env = parent.frame())
source to select from.
expression to order_expr.
environment to look to.
select columns node.
# NOT RUN {
if (requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE)) {
my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
d <- rq_copy_to(my_db, 'd',
data.frame(AUC = 0.6, R2 = 0.2, z = 3))
TARGETCOL = as.name("AUC")
optree <- order_expr(d, .(TARGETCOL)/R2) %.>%
select_columns(., "R2")
cat(format(optree))
sql <- to_sql(optree, my_db)
cat(sql)
print(DBI::dbGetQuery(my_db, sql))
DBI::dbDisconnect(my_db)
}
# }
Run the code above in your browser using DataLab