shinymodules

Using Shiny's updateSelectInput within nested modules

十年热恋 提交于 2021-02-08 08:24:14
问题 Background The application is of the following structure: . ├── R │ ├── mod_observationSelector.R │ ├── mod_previewTable.R │ └── mod_summaryTable.R └── app.R With the files fulling the respective functions: mod_observationSelector.R - provides an updateSelectInput mechanism facilitating selction of integere or real columns in mtcars data mod_previewTable.R - generates head for selected column mod_summaryTable.R - generates summary for selected column Design assumptions mod_observationSelector

Using Shiny's updateSelectInput within nested modules

家住魔仙堡 提交于 2021-02-08 08:23:49
问题 Background The application is of the following structure: . ├── R │ ├── mod_observationSelector.R │ ├── mod_previewTable.R │ └── mod_summaryTable.R └── app.R With the files fulling the respective functions: mod_observationSelector.R - provides an updateSelectInput mechanism facilitating selction of integere or real columns in mtcars data mod_previewTable.R - generates head for selected column mod_summaryTable.R - generates summary for selected column Design assumptions mod_observationSelector

Having difficulty getting an actionButton in a nested Shiny module to work

家住魔仙堡 提交于 2021-01-28 06:31:00
问题 In the following modularized shiny app the insertBtn_outer button works okay, but I am struggling to get the insertBtn_inner button to work. Many thanks for any insights that could help to resolve my issue. library(shiny) innerUI <- function(id){ ns <- NS(id) actionButton(ns('insertBtn_inner'), 'Insert') } inner <- function(input,output,session){ observeEvent(input$insertBtn_inner, { showModal(modalDialog( title = 'Debug message', paste0('The inner button works'), easyClose = TRUE, footer =

How to use shiny:renderUI and shiny:UiOutput to produce conditional outputs with shiny modules

时间秒杀一切 提交于 2019-12-11 16:23:06
问题 This is a slight extension of an earlier question. Note: This solution now works after a typo was identified in the code and corrected. I hope this is a useful pattern that others can use too. I would like different output types to be displayed via uiOutput , but in a modular framework. What I have so far is: module_ui <- function(id){ ns <- NS(id) tagList( selectInput(ns("output_type"), label = "Select type of output", selected = "table", choices = c("table", "barplot", "graph") ), uiOutput

Shiny modules: Destroy module ui if server-function fails

时光总嘲笑我的痴心妄想 提交于 2019-12-08 02:51:42
问题 How to display a blank UI (alternatively destroy module UI), if the module server-function fails, without moving all the UI-code to the server function? Simple reproducible example: library(shiny) my_module_ui <- function(id) { ns <- NS(id) tags$div( tags$h1("Don't show me if my_module_server fails!"), plotOutput(ns("my_plot")) ) } my_module_server <- function(input, output, session) { tryCatch({ my_data <- cars * "A" # fail for demo # my_data <- cars output$my_plot <- renderPlot({ cars2 <-

Shiny modules: Destroy module ui if server-function fails

北城余情 提交于 2019-12-06 07:41:33
How to display a blank UI (alternatively destroy module UI), if the module server-function fails, without moving all the UI-code to the server function? Simple reproducible example: library(shiny) my_module_ui <- function(id) { ns <- NS(id) tags$div( tags$h1("Don't show me if my_module_server fails!"), plotOutput(ns("my_plot")) ) } my_module_server <- function(input, output, session) { tryCatch({ my_data <- cars * "A" # fail for demo # my_data <- cars output$my_plot <- renderPlot({ cars2 <- my_data + rnorm(nrow(my_data)) plot(cars2) }) }, error=function(cond) { message("Destroy UI here!") }) }