dbc <- nodbi::src_sqlite(
dbname = system.file("extdata", "demo.sqlite", package = "ctrdata"),
collection = "my_trials",
flags = RSQLite::SQLITE_RO)
# get fields that are nested within another field
# and can have multiple values with the nested field
dbGetFieldsIntoDf(
fields = "b1_sponsor.b31_and_b32_status_of_the_sponsor",
con = dbc)
# fields that are lists of string values are
# returned by concatenating values with a slash
dbGetFieldsIntoDf(
fields = "keyword",
con = dbc)
# calculate new field(s) from data across trials
df <- dbGetFieldsIntoDf(
fields = "keyword",
calculate = c("f.statusRecruitment", "f.isUniqueTrial", "f.startDate"),
con = dbc)
table(df$.statusRecruitment, exclude = NULL)
if (FALSE) {
library(dplyr)
library(ggplot2)
df %>%
filter(.isUniqueTrial) %>%
count(.statusRecruitment)
df %>%
filter(.isUniqueTrial) %>%
ggplot() +
stat_ecdf(aes(
x = .startDate,
colour = .statusRecruitment))
}
Run the code above in your browser using DataLab