[R] R script from Python

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Oct 18 06:33:06 CEST 2008


This is a python not an R problem.

Use of redirection is handled by a shell, not by the executable (usually: 
it could depend on the compiler).  The Windows system and popen commands 
(and hence R's system()) does not use a shell: POSIX OSes do.

It will be cleaner to use Rscript to run scripts.

Please ask Python questions on a Python help list.

On Sat, 18 Oct 2008, Tomislav Puđa wrote:

> Hi,
>
> I'm trying to execute R-script from Python. I'm using R 2.7.2, Python 2.5
> and WinXP.
> I don't won't to use Python/R interface because of nature of project.

You'll need to explain the arbtirary restrictions you are imposing here.

> Python code :
>
> import subprocess
> command  = 'c:\\Program Files\\R\\R-2.7.2\\bin\\Rterm.exe --vanilla -q
> <d:\\test\\run\\geneBank.r> d:\\output.out'
> subprocess.Popen(command).wait()
>
> After that, I get error messages on Rterm.exe terminal :
>
> ARGUMENT 'd<:\lloydMax.r>' __ignored__
>
> ARGUMENT 'd:\output.txt' __ignored__
>
> Why ?
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list