r - Conditional initial values in shiny UI? -


is there way make initial value of shiny ui input conditional?

consider below example using old faithful eruptions app example shiny's homepage

i akin having individual observations turned off except when input$n_breaks == 50

ui.r

shinyui(bootstrappage(  selectinput(inputid = "n_breaks",           label = "number of bins in histogram (approximate):",           choices = c(10, 20, 35, 50),           selected = 20),  checkboxinput(inputid = "individual_obs",             label = strong("show individual observations"),             value = false),  checkboxinput(inputid = "density",             label = strong("show density estimate"),             value = false),  plotoutput(outputid = "main_plot", height = "300px"),  # display if density shown conditionalpanel(condition = "input.density == true",                sliderinput(inputid = "bw_adjust",                            label = "bandwidth adjustment:",                            min = 0.2, max = 2, value = 1, step = 0.2)))) 

server.r

shinyserver(function(input, output) {  output$main_plot <- renderplot({  hist(faithful$eruptions,      probability = true,      breaks = as.numeric(input$n_breaks),      xlab = "duration (minutes)",      main = "geyser eruption duration")  if (input$individual_obs) {   rug(faithful$eruptions) }  if (input$density) {   dens <- density(faithful$eruptions,                   adjust = input$bw_adjust)   lines(dens, col = "blue")} }) }) 


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -