process=StartProcess[$SystemShell];
outputFile=FileNameJoin[{NotebookDirectory[],"output.txt"}];
ClearAll[run];
run[commands_,seconds_:2]:=Module[{},
commandSent=commands<>" > \""<>outputFile<>"\"";
WriteLine[process,commandSent];
Pause[seconds];
Import[outputFile]
];
$rDirectory="C:\\Program Files\\R\\R-3.3.0\\bin\\x64";
now runnning
run["cd \""<>$rDirectory<>"\""]
and
run["dir"]
produces the same result as running on cmd directly but running
run["R.exe"]
doesn't seem to start the R process. But if i do these directly on cmd it works.
I have used this method several times to connect to external processes but it is not working for R. Someone please help!!!
Run
is for single execution while i want to keep sending a sequence of commands programmatically and retrieve results. Can you please check whether i am the only one having this problem or there is some issue? $\endgroup$RLink
... $\endgroup$RLink
crashes for large data. And has other bugs. I want the program to run in R but queries generated programmatically since there are alot of combinations. $\endgroup$cd
-ing to the directory which has the executable? $\endgroup$