0
votes

I am trying to rebase something if the rebase button is clicked (input$rebase). If it is not clicked, then I want the code to continue with value_new just being value. But if it is clicked, then i want to use the output from rebasesomething ie, i want value_new to be value * 0.5.

How can i do this? I tried the ifexists to see if that function has an output or not (ie if the button has been clicked and some output generated), but that doesn't seem to work. Any other ideas on how this could be done?

Sorry to not give a working example, but the code is huge, just hoping someone can guide me in the right direction.

reactive({
     value <- input$value

     value_new<-value

     ifexists(rebasesomething()){value_new<-value*rebasesomething()}
 
#do a whole bunch of other things with value_new
})


rebasesomething <- eventReactive(input$rebase,{
      
      temp<-0.5
      temp
    })

1
It's unclear to me what you are trying to do. I suggest you try to make a minimal but runnable reproducible example. Ideally start from scratch and add only what's needed to demonstrate the problem. Where does ifexists come from?MrFlick

1 Answers

0
votes

Found the solution, can just use if(input$rebase) to say if a button has been clicked or not:

if (input$rebase){
      
      value_new<-value*rebaselist()
      
    }
    else {
      value_new<-value
      
    }