Run a dplyr query and add the result set to an existing
Examples
if (FALSE) { # \dontrun{
library(CDMConnector)
con <- DBI::dbConnect(duckdb::duckdb(), dbdir = eunomia_dir())
concept <- dplyr::tbl(con, "concept")
# create a table
rxnorm_count <- concept %>%
dplyr::filter(domain_id == "Drug") %>%
dplyr::mutate(isRxnorm = (vocabulary_id == "RxNorm")) %>%
dplyr::count(domain_id, isRxnorm) %>%
compute("rxnorm_count")
# append to an existing table
rxnorm_count <- concept %>%
dplyr::filter(domain_id == "Procedure") %>%
dplyr::mutate(isRxnorm = (vocabulary_id == "RxNorm")) %>%
dplyr::count(domain_id, isRxnorm) %>%
appendPermanent("rxnorm_count")
DBI::dbDisconnect(con, shutdown = TRUE)
} # }