if (requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE)) {
my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
d1 <- rq_copy_to(my_db, 'd1',
data.frame(A = c(NA, 2, 3, NA), B = c(3, NA, 4, NA)))
optree <- null_replace(d1, qc(A, B),
0.0, note_col = "alterations")
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