Create a reactive function outside the shiny app

Viewed 2109

I am trying to decompose the code of my shiny app in order to improve readability and to test some functions using the testthat package.

I would like to have some files (for example server_utils.R) in which I can write "normal" functions that I can test and then make them reactive.

For example I would like to have something like this in server_utils.R:

my_sum <- function(x, y) {
  x + y
}

and something like this in the app:

my_sum_reactive(input$x, input$y)

Do you know if a such behavior is possible?

1 Answers
Related