Skip to content
Prev 89 / 139 Next

Call to R.exe in a Script fails since the upgrade from R 3.6.1 to R 4.0.2

Dear Uwe and SIG Windows members,

I realize that my message was missing the code elements. Apologies!

I write again:

I call R from within a software called ?IDEA? (www.casewareanalytics.com). This language uses its own scripting language, but it is very similar to Visual Basic. The basic call is as shown below:
 
Function R_ExecuteScript() As Variant
' Execute the R script and wait until it is finished.
     Dim R_Command As String
     Dim WshShell As Object
     Set WshShell = CreateObject("Wscript.Shell")
     R_Command = Chr(34) & R_Program & Chr(34) & " -f " & Chr(34) & R_Script & Chr(34) & " --args " & Chr(34) &     R_FormatPath(R_ProjectFolder & "\nga_config.r") & Chr(34) &"  1> " & Chr(34) & R_ProjectFolder & "\log.txt" & Chr(34) & " 2>&1 "
     WshShell.run R_Command, 0, TRUE   
     Set WshShell = Nothing
End Function
 
R_Command is a string of the form
 
"C:\R\R-3.6.1\bin\x64\R.exe" -f "script.R" ?-args "args.R" 1> "log.txt" 2>&1
 
In my file ?script.R?, I then start everything by:
 
args <- commandArgs(TRUE)
print(args)
source(args[1])
 
This has worked perfectly up to R 3.6.1. But since I migrated to R 4.0.2, this command does not create the ?log.txt? anymore. The script runs, it finds the arguments in the file ?nga_config.R?, generates the output data, but then does not write the log.txt.
 
However, when I run this R_command on the command line in Windows, all works fine: the log.txt is created. So the syntax is correct.
 
Do you whether something has changed in R 4.* that could cause this issue? Would you know somebody who can help me?

Thanks for your insight!

Marcel