if (interactive()) {
library(magrittr)
library(shiny)
library(cohortBuilder)
library(shinyCohortBuilder)
library(shinyWidgets)
coh <- cohort(
set_source(as.tblist(librarian), available_filters = list(
filter(
"range", id = "copies", name = "Copies", dataset = "books",
variable = "copies", range = c(5, 12)
),
filter(
"date_range", id = "registered", name = "Registered", dataset = "borrowers",
variable = "registered", range = c(as.Date("2010-01-01"), Inf)
)
))
) %>% run()
filter_choices <- .available_filters_choices(coh$get_source(), coh)
ui <- fluidPage(
virtualSelectInput("filters", "Filters", choices = filter_choices, html = TRUE)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab