Thank you very much for your help. It did work. So here is the code that I've used case anybody else is seaching for an answer to this problem :
System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = "E:/R/bin/Rscript.exe"; proc.StartInfo.WorkingDirectory = "E:/R/bin/"; proc.StartInfo.Arguments = "E:/R/bin/test.r"; proc.StartInfo.UseShellExecute = true; proc.StartInfo.RedirectStandardOutput = false; proc.Start(); Thanks again for your help, good luck. Alex On 8/21/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > > On Tue, 21 Aug 2007, Alex MD wrote: > > > Hi, > > > > I know that the general subject "calling R from C" has been discused but > I > > have been reading the manuals and also scouting the lists and I can not > seam > > to find > > a working solution for my problem. > > It's a C# issue. > > > I want to call a R script ( let's call it "test.r" ) from within C# > code. > > After reading about this topic I am trying to do this : > > > > System.Diagnostics.Process proc = new System.Diagnostics.Process(); > > proc.StartInfo.FileName = "E:/R/R-2.5.1 /bin/Rterm.exe"; > > proc.StartInfo.Arguments = " <'test.r' --no-save"; > > proc.StartInfo.UseShellExecute = false; > > proc.StartInfo.RedirectStandardOutput = false; > > proc.Start(); > > > > > > bun when Rterm starts it shows parameter <test.r ignored > > > > When I try to do the same from a command line shell it DOES work just > fine : > > " Rterm.exe <test.r --no-save" runs the file without any problems. > > > > Do you have any idea how to make it not to ignore the input file? Or is > > there other way to just execute a .r file from C# code? > > You need a shell for redirection (< > |) to work, and 'system' commands in > Windows do not usually use one (as in C, C++, R, Perl): you seem to have > turned off using a shell in C#. However, I think you should be using > RScript.exe, where this is not an issue. > > -- > Brian D. Ripley, [EMAIL PROTECTED] > 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 > -- Alexandru Maruseac BEST Bucharest E-mail: [EMAIL PROTECTED] Tel:+40 0722 329 083 www.BEST.eu.org www.BESTBc.pub.ro [[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch 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.