Is there an easy way to compile my R
script into standalone .exe
file just like what matlab does?
In fact, you can take any R script and compile it into a report that includes commentary, source code, and script output. Reports can be compiled to any output format including HTML, PDF, MS Word, and Markdown. The first call to render creates an HTML document, whereas the second creates a PDF document.
Rscript.exe is for running an existing script (file) containing R commands. You generally invoke Rscript.exe with the name of the script.
You produce executable code by compiling and linking in one step. An executable file has a filename extension of .exe. To produce executable code, you need to modify the Output Type setting in the project properties.
As a matter of fact there is a way to achieve solution that would meet your requirements. Have a look at the article on Deploying Desktop Apps with R on R-Bloggers. As detailed in the article, you will end up using a few more things than a single exe file.
Also I would like to draw your attention to the RGtk2 with use of the RGtk2 you could attempt to develop your own interface in R. If push comes to shove, I trust that you could pack your R code together with a portable version of R and dependencies into one installer and make and app from that, that would create an illusion of a single exe file.
In your question you asked whether it's easy to develop a standalone executable file interpreting R code. I wouldn't say it's easy. If you have a strong desire to run a R code from an application, you could do it in a simpler manner using RCaller for Java or R.NET.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With