| picks_module | R Documentation |
Creates UI and server components for interactive picks() in Shiny modules. The module is based on
configuration provided via picks() and its responsibility is to determine relevant input
values
The module supports both single and combined picks:
Single picks objects for a single input
Named lists of picks objects for multiple inputs
picks_ui(id, picks, container = "badge_dropdown")
## S3 method for class 'list'
picks_ui(id = "", picks, container = "badge_dropdown")
## S3 method for class 'picks'
picks_ui(id, picks, container = "badge_dropdown")
picks_srv(id, picks, data)
## S3 method for class 'list'
picks_srv(id = "", picks, data)
## S3 method for class 'picks'
picks_srv(id, picks, data)
id |
( Only when
|
picks |
( |
container |
( |
data |
( |
The module uses S3 method dispatch to handle different ways to provide picks:
.picks methods handle single 'picks“ object
.list methods handle multiple picks objects
The UI component (picks_ui) creates the visual elements, while the
server component (picks_srv) manages the reactive logic,
picks_ui(): UI elements for the input controls
picks_srv(): Server-side reactive logic returning the processed data
picks() for creating 'picks“ objects
library(shiny)
example_pick <- picks(
datasets("ADSL"),
variables(selected = c("SEX", "COUNTRY", "ARMCD"))
)
ui <- fluidPage(
picks_ui("my_picks", picks = example_pick),
h4("Resolved picks:"),
verbatimTextOutput("result"),
h4("Table:"),
tableOutput("table")
)
server <- function(input, output, session) {
data <- teal.data::teal_data("ADSL" = teal.data::rADSL)
teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys["ADSL"]
selectors <- picks_srv(
picks = list(my_picks = example_pick),
data = reactive(data)
)
anl <- merge_srv("merge", data = reactive(data), selectors = selectors)
output$result <- renderPrint(cat(gsub("\033\\[[0-9;]*m", "", format(selectors$my_picks()))))
output$table <- renderTable(anl$data()$anl)
}
if (interactive()) {
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.