R shiny - stop() in eventReactive without error message in console -
i new in shiny, , have problem. have event reactive , stop function inside. when run code(no checkbox , click button), shiny work well. in console display error message "eventreactivehandler". have solution problem? want no error message in console. , not expect solution
opt <- options(show.error.messages=false) on.exit(options(opt))
because error not display in code, want in error. thank you... code...
rm(list = ls()) library(shiny) library(shinybs) var.x<-reactivevalues() shinyapp( ui = fluidpage( sidebarlayout( sidebarpanel( checkboxgroupinput("indepvar","independent variable", choices = c("1"=1,"2"=2)), actionbutton("tabbut", "view table") ), mainpanel( uioutput("coba"), uioutput("popup4") ) ) ), server = function(input, output, session) { output$coba <- renderui({ gendata() indep<-null for(i in 1:length(var.x)){ indep <- paste(indep,var.x[i],",") } list( rendertext(indep) ) }) gendata<- eventreactive(input$tabbut,{ if(is.null(input$indepvar)){ stop() } var.x<<- input$indepvar }) output$popup4 <- renderui({ if(!is.null(input$indepvar))return() list( bsmodal("modalexample4", "peringatan", "tabbut", size = "small",wellpanel( "anda belum memilih independent variabel..." )) ) }) } )
i wouldn't advise suppressing error messages, there in there you, suggest validate
, need
in shiny
, can go read validation article
to quickfix
issue can return null
rm(list = ls()) library(shiny) library(shinybs) var.x<-reactivevalues() shinyapp( ui = fluidpage( sidebarlayout( sidebarpanel( checkboxgroupinput("indepvar","independent variable", choices = c("1"=1,"2"=2)), actionbutton("tabbut", "view table") ), mainpanel( uioutput("coba") ) ) ), server = function(input, output, session) { output$coba <- renderui({ gendata() indep<-null for(i in 1:length(var.x)){ indep <- paste(indep,var.x[i],",") } list( rendertext(indep) ) }) gendata<- eventreactive(input$tabbut,{ if(is.null(input$indepvar)){ var.x <<- null return(null) stop() } var.x<<- input$indepvar }) } )
Comments
Post a Comment