In Python, it is literally this easy:
import rpy2.robjects as robjects
robjects.r("""
source("C:/ YOUR R FILE GOES HERE ")
""")
Type the name of your R source code into this script and save it as a Python
script (add the suffix .py), and then you can run by double-clicking. If
you want to see the results of your program, you'll have to have R print
them in a file.
Now, to get Python to run on your computer, you'll have to install the
following:
http://www.python.org/download/releases/2.6.5/ Python 2.6.5
http://sourceforge.net/projects/numpy/files/ NumPy 1.4.1
http://sourceforge.net/projects/rpy/files/rpy2/ Rpy2 2.0.8
(Note that these are the versions I currently have on my computer, there may
be more recent ones out there.)
You will also have to add Python to your computer's Path. To do this in
Windows:
1. Right-click on My Computer, select Properties
2. On the Advanced tab, click Environmental Variables
3. In the System Variables list, select Path and click Edit
4. In the Variable Value line, enter "C:\Python26\;" at the beginning
of the
line (or "C:\Python30\" if you choose to install Python 3.0)
Now you can run Python scripts simply by double clicking them. This makes
it very easy to turn R codes into an executable script; the only caveat is
that you need to have Python installed on any computers that you want to run
your script on.
--
View this message in context:
http://r.789695.n4.nabble.com/executable-script-tp839859p2254813.html
Sent from the R help mailing list archive at Nabble.com.