-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04_cohort_gui.R
36 lines (31 loc) · 961 Bytes
/
04_cohort_gui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# shinyCohortBuilder
library(magrittr)
# Load lobrarian dataset
load("librarian.rda")
# Create binding keys
librarian_source <- cohortBuilder::set_source(
cohortBuilder::as.tblist(librarian)
)
# Create cohort
coh <- librarian_source %>%
cohortBuilder::cohort(
cohortBuilder::step(
cohortBuilder::filter(
"discrete", id = "author", dataset = "books",
variable = "author", value = "Dan Brown", active = TRUE
),
cohortBuilder::filter(
"range", id = "copies", dataset = "books",
variable = "copies", range = c(0, 10), active = TRUE
),
cohortBuilder::filter(
"date_range", id = "registered", dataset = "borrowers",
variable = "registered", range = c(as.Date("2010-01-01"), Inf),
active = TRUE
)
),
run_flow = TRUE
)
# Run simple cohort gui
shinyCohortBuilder::gui(coh)
shinyCohortBuilder::gui(coh, steps = FALSE, stats = "pre", run_button = "global")