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?
1 Answer
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.
stdoutin 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.