Displaying 1 result from an estimated 1 matches for "runrcod".
Did you mean:
runrcode
2010 Apr 18
2
how to use Excel VBA's Shell() to call and execute R file
...ke
this:
setwd("C:/R_test")
rnorm(100)
write(rnorm(100),"data.txt")
q(save="no", runLast = F)
Next I would like use an Excel VBA/macro Shell() function to call R and
execute R_test.R file. The syntax is *Shell(pathname*[*,windowstyle*]*)*
I wrote an Excel macro RunRcode like this:
Sub RunRcode()
Dim RetVal
RetVal = "C:\Program Files\R\R-2.10.1\bin\Rgui.exe & C:\R_test\R_test.R”
RetVal = Shell(RetVal, vbNormalFocus)
End Sub
When this macro is run, the R is opened but R_test.R file is ignored.
If I change RetVal = "C:\Program Files\R\R-2....