A solution for R creating executive file
- Python 3.4 (Installed by Anaconda 4.3.21)
- R 3.4.1
- py2exe (I use pip in Anaconda)
- You should add the path of "Rscript.exe" into System variables PATH, or cmd can't find Rscript.exe when you want to execute R in cmd. (How to add system variables)
- install python and py2exe
(you can skip this part if you don't want to generate executive file by yourself)
Use Python to call specific R script. (You can do it with "performR.py")
Use py2exe to pack "performR.py", and you will get 'dist' directory. (You will do this step by "setup.py")
Entering "python setup.py py2exe" in cmd, and py2exe will start packing.
(there are two example, see directory "pack" and "library")
Write your R script, name "Rscript.r" and put your script into the same directory as "performR.exe"
Double click 'performR.exe', it will perform the context of R script (Rscript.r).
- You should put your R script in the directory where "performR.exe" exist.
- It is fine to library package and plot.
Read data from outside.
py2exe tutorial: http://www.py2exe.org/index.cgi/Tutorial