RProcessStart: RProcessStart

Description Usage Arguments Details See Also

View source: R/RProcessStart.R


This module starts a custom R script. Together with RProcessFinish this module can start and observe a custom R script as background process. Both functions are combined in a convenience function RProcess.


RProcessStart(input, output, session, trigger, object, script, logFile = NULL,
  sessionid = NULL, pwd = getwd(), checkFun = NULL, addArgs = NULL)



argument used by shiny session


argument used by shiny session


argument used by shiny session


reactive which starts the process (e.g. action button input)


reactive object that will be handed over to R batch script as input


chr path to R batch script (name of file included)


chr or NULL (NULL) path of logging file (name included). Will be created if it doesnt exist.


chr or NULL (NULL) id for the session. Log entries will be prefixed with it.


chr (getwd()) path of R batch process working directory. That's where intermediate files will be written as well.


chr or NULL (NULL) if not NULL name of a function which can be used as a quality check for object right before it is handed ober to the R batch script


list or NULL (NULL) if not NULL list of additional arguments which will be passed to checkFun


If this function is used together with RProcessFinish, they both need to be called with the same id and the same pwd (working directory).

The communication between the shiny session and the R script is done via a *.status file. Input and output are handed over via a *.rds file. The working directory of the process can be defined with pwd. This is where the files are read and written as well.

There is the option to let the R script write a log. The desired log file can be given with logFile. If several users use the app it might be useful to include a unique id with sessionid. Every log entry will be appended with it.

With checkFun a function name can be defined which will be used as quality control for object. This function is run before the R batch script is started. First argument of this function is the object. The function must either return NULL or a chr value. NULL means the input is valid. Thereby the module will start the R script. If the input should not be valid, the function must return a character value. This chr will be rendered as a error message for the user, and the modul will not start the R script. Additional arguments to this checkFun can be handed over with addArgs.

To ensure that the communication between the shiny session and the R script is working properly, use Rscript_Init to start the script and Rscript_Fin to finish it. These functions belong to the Rscript communication function which should be used in the R script for communication with the shiny session. For examples see the vignette on RProcess Module Functions (vignette("RProcess_functions", package = "shinyTools")).

See Also

Seome examples on how to use RProcess module functions are given in the vignette RProcess Module Functions (vignette("RProcess_functions", package = "shinyTools"))

In the R script communications functions such as Rscript_Init and Rscript_Fin should be used to ensure correct communication between the R script and the shiny session.

Other RProcess module functions: RProcessFinishUI, RProcessFinish, RProcessStartUI, RProcessUI, RProcess

mRcSchwering/shinyTools documentation built on May 21, 2017, 4:43 p.m.