r - Reactive input? -


suppose shiny app looks this:

## app.r ## library(shiny) library(shinydashboard)  ui <- dashboardpage(   dashboardheader(),   dashboardsidebar(radiobuttons("output", "continuous or binary:",                                 c("continuous" = "continuous",                                   "binary" = "binary"),                                  selected = "continuous"),                     numericinput("sigma_y", "sd of y:", 0.1,                                 min = 0, max = na, step = 0.01),                    numericinput("mean_y", "mean_y:", 0.1,                                 min = 0, max = na, step = 0.01)),   dashboardbody() )  server <- function(input, output) { }  shinyapp(ui, server) 

how can show sigma_y if output==continuous , mean_y if output==binary?

i tried adding if(input$output=="continuous") not work :(

thanks!

dynamically create numericinput

rm(list = ls()) library(shiny) library(shinydashboard)  ui <- dashboardpage(   dashboardheader(),   dashboardsidebar(radiobuttons("output", "continuous or binary:",                                 c("continuous" = "continuous",                                   "binary" = "binary"),                                  selected = "continuous"),                     uioutput("test")),   dashboardbody() )  server <- function(input, output) {     output$test <- renderui({      if(input$output=="continuous")     {       numericinput("sigma_y", "sd of y:", 0.1,min = 0, max = na, step = 0.01)     }      else if(input$output=="binary")     {       numericinput("mean_y", "mean_y:", 0.1,min = 0, max = na, step = 0.01)     }     else     {       return()     }   }) } shinyapp(ui, server) 

Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -