Posts

Showing posts from January 22, 2019

Confused by difference between running R from batch file versus running it directly from shell

Image
2 I recently came across a strange error, and while I managed to fix it, I cannot for the life of me figure out what was going wrong behind the scenes and I would like to understand what was going on. I am currently writing a program that takes Excel inputs and uses them to direct a program written in R, that ultimately spits out results to be fed back into Excel for user review. My original solution utilized a batch file that consisted of a single line, calling: Rscript "Rfilepath.R" that was called from VBA using the below: Dim wsh As Object Set wsh = VBA.CreateObject("WScript.Shell") Dim waitOnReturn As Boolean: waitOnReturn = True Dim windowstyle As Integer: windowstyle = 1 wsh.Run Chr(34) & BatchFilePath & Chr(34), windowstyle, waitOnReturn However, this proved unabl