My goal is to make a reactive brilliant function in R. There are several outputs (e.g. tables) that can be associated with a similar function. However, I need a function to respond to some parameter specific to one table. Here are some simple examples of code that doesn't work, but that makes my idea clear - hopefully:
output$tableOne <- DT::renderDataTable({ getData(foo) }) getData <- reactive(function(funParameter){ corrStartDate <- input$StartDate corrEndDate <- input$EndDate return(someData(corrStartDate, corrEndDate, funParameter)) })
In all tables (if there are more than one), I will not show data with a different base parameter (getData (x, y, foo)). So the second table can use "getData (x, y, bar)". I do not want to write the same function every time for another table.
The solution above does not work, because reactive functions do not support parameters.
How would you solve this?
source share