0

I have several R scripts that take in data (likely from arguments passed to Rscript or a bat file), chug through a calculation and at the end output either a list or vector of values (generically floats and strings). How can I output only these values to stdout (or whatever is appropriate) to the calling C# process without resorting to writing and reading files as a middle man?

Tommy Levi
  • 771
  • 5
  • 12
  • possible duplicate of [Best Way to call external program in c# and parse output](http://stackoverflow.com/questions/878632/best-way-to-call-external-program-in-c-sharp-and-parse-output) – TypeIA Mar 18 '14 at 21:45
  • Yup, that's the C# end of things, but there are R specific issues (like directing correctly to stdout and only outputting the necessary variables) that the linking question doesn't address. – Tommy Levi Mar 18 '14 at 21:53
  • How to print values to `stdout` in R would probably justify its own question (or a Google search). The title (and indeed body) of the question does not cover how to print from R. – TypeIA Mar 18 '14 at 21:55
  • Would you then be satisfied if I updated the title/body of this post to reflect that? – Tommy Levi Mar 18 '14 at 21:58
  • Done, see if you like that phrasing better? – Tommy Levi Mar 18 '14 at 21:59

1 Answers1

0

There are several options available to pass data in-memory between R and .NET/Mono or over a network pipe, without file I/O in-between. I'll mention a couple I am partial to, being respectively a contributor to, and author of,

  • R.NET if the entry point is a program running on .NET or Mono, calling R. A new release is under development.
  • the rClr package if R is the main process. Mirrored on a GitHub repository. The latest official binary release is available, at the time of writing, at r2clr.codeplex.com.
j-m
  • 1,473
  • 1
  • 13
  • 17