how to capture the console output of R

Oct 2, 2013 at 10:39 AM
Edited Oct 2, 2013 at 11:12 AM
I am using R.net which is awesome.

when running .r file, i chould not get the output out the r script.

is there any way to show it in my C# project ?

I try to implement the interface RDotNet.Devices.ICharacterDevice, but there seems no place to use it.

I use sink() in my .r file:

sink(d:/result.txt', append=TRUE)
x<-2
y<-array(1:20,c(12,20))
x*y
hist(y)
sink()

and run it in C#. the "hist(y)" script can show a plot window correctly, the "result.txt" file is created correctly, but there is nothing in it .

when I run the script in R console, there is text in "result.txt"
Developer
Oct 10, 2013 at 10:58 AM
I cannot allocate time to look deep into it, and I am not overly familiar with stream redirection and ICharacterDevice, but it looks like you are on the right track.

Did you find previous discussions on this topic such as https://rdotnet.codeplex.com/discussions/261917 ?