available-filters-choices {shinyCohortBuilder} | R Documentation |
Generate available filters choices based on the Source data
Description
The method should return the available choices for virtualSelect input.
Usage
.available_filters_choices(source, cohort, ...)
## Default S3 method:
.available_filters_choices(source, cohort, ...)
## S3 method for class 'tblist'
.available_filters_choices(source, cohort, ...)
Arguments
source |
Source object. |
cohort |
cohortBuilder cohort object |
... |
Extra arguments passed to a specific method. |
Value
'shinyWidgets::prepare_choices' output value.
Examples
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)
}
[Package shinyCohortBuilder version 0.2.1 Index]