Description Usage Arguments Details Value See Also
This module starts and then observes a custom R script as a background process.
The app stays responsive while the R script is running.
It is a convenience function which combines RProcessStart
and RProcessFinish
1 2 3 |
input |
argument used by shiny session |
output |
argument used by shiny session |
session |
argument used by shiny session |
trigger |
reactive which starts the process (e.g. action button input) |
object |
reactive object that will be handed over to R batch script as input |
script |
|
logFile |
|
sessionid |
|
pwd |
|
checkFun |
|
addArgs |
|
millis |
|
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")
).
list with elements 4 elements
finished indicating the time at which the R script has finished (NULL
if not finished yet)
result the actual output of the R script (NULL
if not finished yet)
error if the R script finished with an error, a relevant message is given here as chr
(NULL
if no error occured)
progress num
indicating progress of R script (1 if finished, [0,1[ if running, NULL
otherwise)
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
,
RProcessStart
, RProcessUI
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.