Reputation: 1713
I have written an interactive R Script which gives the user certain options using which the rest of the execution takes place. These inputs have to be optional as required by the user. One other requirement from the user was that he did not want to manually select the entire script in RStudio just to execute it. I tried to create a BAT
file for this execution. However, the program does not execute. Below is an example user interactive script.
FYI_Splitter <- winDialog(type = "yesno","Do you want to remove FYI from base file?
Yes = Remove FYI
No = Do Not Remove FYI")
Below is what I am using to execute the BAT
file.
"C:\Program Files\R\R-3.4.2\bin\Rscript.exe" "<Path_of_file>\Test_Program.R"
I came to know that batch file execution does not support interactive sessions. Is there any way to make interactive sessions in R execute without selecting the entire code in RStudio? Any help on this would be appreciated.
Upvotes: 1
Views: 1429
Reputation: 31
You could try
echo source("<Path_of_file>\Test_Program.R") | R.exe --ess --vanilla
The interactive() command in R then returns TRUE for me.
Upvotes: 0