
project data by grouping, and adding aggregate columns.
project_se(source, groupby, assignments, env = parent.frame())
source to select from.
grouping columns.
new column assignment expressions.
environment to look for values in.
project node.
# NOT RUN {
my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
d <- dbi_copy_to(my_db, 'd',
data.frame(AUC = 0.6, R2 = 0.2))
eqn <- project_se(d, "AUC", "v" := "max(R2)")
cat(format(eqn))
sql <- to_sql(eqn, my_db)
cat(sql)
DBI::dbGetQuery(my_db, sql)
DBI::dbDisconnect(my_db)
# }
Run the code above in your browser using DataLab