How do I convert .r to .exe file?

I would like to create/convert a .r script (in R studio) to an executable - batch(.exe) file.

Which command should I use?
I have tried: chmod +x test.R

in cmd - command window

R doesn't really have a stand-alone binary format, like .exe. You can make a batch (.bat) file, which is a text file, in which you would write something like:

/customze/path/to/Rscript.exe --vanilla /customize/path/to/your_script.R

You would need to make sure whoever you wanted to run the file had both Rscript, and your_script.R, and in those same locations - if you planned to transfer it to someone else.


I have created a .bat file with the following commands:

C:/Program Files/R/R-4.0.5/bin/R.exe --C:/Users/hp/Desktop/test2.R

but cmd command window shows me:
'C:/Program' is not recognized as an internal or external command,
operable program or batch file.

where do I made mistake?

Try this:

"c:\Program Files\R\R-4.0.5\bin\Rscript.exe" --vanilla "c:\Users\hp\Desktop\test2.R"

I think in Windows you want to both use Rscript.exe, and keep the paths and files together in quotes

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.