
Hi,

I am running a test to call an R script with in excel using VBA. My VBA
code is shown bellow. The middle section of this mail also includes the
content of my Rscript.  The bottom part shows the error message form the
R console.

It seems that Excel is  opening the R console without any problems. 

The problem I am seeing is that Rinterface.RRun  instruction is
interpreting the "\T" part of the path as an R command. It does not
recognize the "X:\Trading\Energy\JorgeSpace\TMPholder\cpixe\home
models\" as a one single string, or path.


Any ideas how can I fix the problem?

Thanks ,'

Jorge


VB code
Sub tester()

    Rinterface.StartRServer
 
     Rinterface.RRun
("source('X:\Trading\Energy\JorgeSpace\TMPholder\cpixe\home
models\toto.R')")    

    Rinterface.StopRServer
    
End Sub



"R cript code toto.R"
path = getwd()
setwd(path)
a = 5
b=5
x = matrix(rnorm(a*b),a,b)
a = 5
b=5

y = matrix(rnorm(a*b),a,b)
z = x %*% y
savefile = paste(path,"/","testresults.csv",sep="")
write.csv(z, file = savefile)





Rconsole message

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Loading required package: rcom
Loading required package: rscproxy
Error: '\T' is an unrecognized escape in character string starting
"source('X:\T"
> > 

Jorge Nieves



	[[alternative HTML version deleted]]

