I am trying to achieve the following results with this code. Basically I want to store an output from res() when i click the "set as base" button to store for later.
The code works perfectly when you uncomment the blocks of code that are currently commented out. But gives me this error otherwise: evaluation nested too deeply: infinite recursion / options(expressions=)?
Why does the "resultmult" need to be output in the UI for the code to work work? Seems like a bug.
Input = 5. Run. Output = 5. Setbase. Change input to 10. Click rebase. Click Run. Output Should be 50.
Then if I change input = 4. Leave rebase ticked. Click Run. Output Should be 4base = 45 =20.
Then should be able to set the output (20) as base by clicking set base. Then change input to lets say 3. Have rebase ticked. Click run. Output should be 3*20 = 60
tempserver<-shinyServer(function(input, output, session){
res<-eventReactive(input$runit,{
if(input$rebase){
mult<-multiplyer()
result <- input$numin * mult}
else {result<-input$numin}
result
})
multiplyer <-
eventReactive(input$setbase, {
res()
})
output$resultoutput<- renderText({
res()
})
# output$resultmult<- renderText({
# multiplyer()
#
# })
})
tempui<-shinyUI(fluidPage(
fluidRow(
column(4,numericInput('numin', 'Input Number', 2)),
column(4, actionButton("runit","Run")),
column(4, actionButton("setbase","Set As Base")),
column(4, checkboxInput("rebase","ReBase")),
column(4, textOutput("resultoutput"))
# ,column(4, textOutput("resultmult"))
)
))
shinyApp(server=tempserver,ui=tempui)