I thought about this, and I think it is possible, but the implementation that I mean depends on the platform. In this case, I will consider ubuntu 14.04.
Suppose you have some kind of computationally intensive task:
ui.R:
library(shiny) fluidPage( numericInput('number','Number',10000000), textOutput('CalcOutput') )
server.R
library(shiny) function(input,output,session) { output$CalcOutput <- renderText({ sort(runif(input$number)) }) }
transfer the operation to the function of the corresponding variables in the subfile:
newfile.R
saveRDS(sort(runif(commandArgs(TRUE)[1])), file = 'LargeComputationOutput')
change your server. R
function(input, output) { observe({
This is still a bit wrong, but it is a proof of concept that you can move intensive operations into subprocesses and detect a reactive listener when doing these calculations.
EDIT: Shiny will also need permissions to write to the appropriate location.
Shape source share