[R] RExcel - RunRFile Errors
kball_ea
kenjiball at energyaction.com.au
Fri Sep 9 05:46:20 CEST 2011
Hi,
I am using RExcel and trying to pass a line of code into R. When I select
the cell and choose "Run Code" from the RExcel menu then it seems to work
fine.
The problem I face is a need to write a macro to do this operation, as I
need to set up a user interface in excel for other users who don't know how
to use R.
In R to run my entire code I simply write on line:
source("S:/Folder/FileName.R")
As mentioned in RExcel I can run by selecting the cell and choosing Run
Code.
I have tried to write the macro for this operation as the following:
Sub FindIndex()
' To run the price index in R
Application.DisplayAlerts = False
Rinterface.StartRServer
Rinterface.RunRFile "S:/Folder/FileName.R"
'RInterface.StopRServer
Application.DisplayAlerts = True
End Sub
But it returns the error "Error when sourcing R file S:/Folder/FileName.R"
I have also tried a simple
RInterface.RRun("source(""S:/Folder/FileName.R"")")
But it did not work.
Can anyone help me in writing this macro?
Thanks in advance.
--
View this message in context: http://r.789695.n4.nabble.com/RExcel-RunRFile-Errors-tp3800748p3800748.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list