Can this process be simplified?
First, I manually open this file in R: C:\R\ExampleModel\ModelScript.R
From R-Editor, when the code below is run from the open ModelScript.R file, it processes the Model.R script correctly.
source("C:\\R\\ExampleModel\\Model.R", echo=T)
Within Excel, I want to run the source code above without manually opening ModelScript.R from R first. Is there anything I can modify in the VBA code below to process the source() command automatically from Excel/VBA? If a batch process is the only option, short of Rexcel, please use the example extensions provided.
Excel 2007 VBA code:
Sub RRUN()
Dim rCommand As String
rCommand = "C:\\Program Files\\R\\R-3.0.0\\bin\\Rscript.exe --verbose C:\\R\\ExampleModel\\ModelScript.R"
'Timer Set to run full Model.R script
Application.Wait Now + TimeValue("00:00:05")
'Runs R Script and Arguements into process
Shell rCommand, vbNormalFocus
'Timer Set to run full Model.R Script
Application.Wait Now + TimeValue("00:00:05")
End Sub
Note: I tried using R.exe in place of Rscript.exe above, with no results.