Reactive Function Parameters

后端 未结 1 1922
悲&欢浪女
悲&欢浪女 2021-02-06 12:27

My goal is to make a reactive shiny function in R. There are multiple outputs (e.g. tables) which can be bind to a similar function. However I need the function to react on some

1条回答
  •  感情败类
    2021-02-06 13:05

    This should work instead:

    getData <- eventReactive(input$funParameter, {
      corrStartDate <- input$StartDate
      corrEndDate <- input$EndDate
    
      return(someData(corrStartDate, corrEndDate, input$funParameter))
    })
    

    eventReactive only updates if arguments stated up front change. Practically speaking, this reactive will not trigger if input$StartDate or input$EndDate changes.

    If this is not what you want, normal reactive functions should work. I.e.:

    getData <- reactive({
    
      funParameter <- input$funParameter
      corrStartDate <- input$StartDate
      corrEndDate <- input$EndDate
    
      return(someData(corrStartDate, corrEndDate, funParameter))
    })
    

    which will trigger if any of the inputs change

    0 讨论(0)
提交回复
热议问题