I realize this is an old post, but thought it's good to answer for other
folks that hit it during a search.
RExcel is fantastic. However, it requires all the users to install RExcel.
So the VBA approach may still be a good alternative in some simple cases,
like the example question.
I think what
Hi KZ,
I don't think that I can answer what I think is the precise question - how
to run the R file from VBA but without using RExcel.
However with RExcel installed, I have found it very straightforward to run R
code from within VBA (thanks Erich Neuwirth - RExcel is great). The VBA
code is:
R
I have an R file R_test.R saved in C:\R_test folder. The R_test.R looks like
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*[
3 matches
Mail list logo