[R] How to bypass the pause in a program invoked using the "system" command
Zhiqiu Hu
zhiqiu.hu at gmail.com
Thu Dec 17 02:20:44 CET 2015
Dear Friends,
I want to run a standalone console program (emBayesB) from R script on
windows console. However, because the program asks user to press the enter
key at each time after the analysis, the R code always stuck after invoking
the emBayesB program with the "system()" function.
For reproduce the issue, please save the following content as
a "c:\RScript.R" file
##### start ########
AppPath="c:\\bin\\emBayesB_gs.exe"
system(AppPath, wait = TRUE)
##### end ##########
And copy the "emBayesB_gs.exe" file into "c:\\bin". The emBayesB program is
freely accessible at (additional file 3) the follow website
http://www.biomedcentral.com/1471-2105/11/529/additional
Then, if you try to run the following command on windows console, you will
see the issue.
##### start of console command ##########
c:\\R\\bin\\Rscript.exe c:\\RScript.R
##### end of console command ##########
FYI, if you submit the "c:\\R\\bin\\Rscript.exe c:\\RScript.R" use the
"system()" function in R (tested with R-studio), you will not required to
press the enter key to finish the run.
Although, the emBayesB program was used in my case, but I suppose it is a
general issue as you call any standalone program that require users
to press key to exit, by run R scripts on windows console .
Any suggestion is appreciated!
Please let me know if you require more information about the issue.
[[alternative HTML version deleted]]
More information about the R-help
mailing list