[R] Run an external software in R

William Dunlap wdunlap at tibco.com
Wed Sep 7 06:25:51 CEST 2016


You can use system() or shell(), which adds "cmd.exe /c " to the front of
your command
so you can use DOS syntax.  Remember to add double quotes when file names
have
spaces in them.  E.g., I can call an old version of R with the following
and later read its
text output into my current session.

> infile <- tempfile()
> cat("getRversion()\n", file=infile)
> outfile <- tempfile()
> shell(paste("\"C:\\Program Files\\R\\R-2.15.1\\bin\\R\" --quiet --vanilla
<", infile, ">", outfile))
> readLines(outfile)
[1] "> getRversion()" "[1] '2.15.1'"    "> "



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Sep 6, 2016 at 6:13 PM, Marino David <davidmarino838 at gmail.com>
wrote:

> Hi all R users:
>
> Does anybody have the experience of running an external software in R? I
> try to use R to run ANSYS software, which is a engineering simulation
> package. I ever have done this task in Matlab platform by executing
> the following code line:
>
> system('"C:\Program Files\Ansys Inc\v100\ANSYS\bin\intel\ansys100" -b -p
> ane3fl -i D:\Ansys\MyAnsysCode.txt -o D:\Ansys\vm5.out');
>
>
> Any idea regarding implementing this work is very welcome.
>
> David
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list