[R] Plotting C++ output in R

Warren Young warren at etr-usa.com
Thu Apr 16 20:27:18 CEST 2009


Andrew.Cox at lshtm.ac.uk wrote:
> 
> I want to be able to continuously plot the output from the model in R
> each time a new run generates data.

 From the C++ program, run the R script that plots the data.  Something 
like this:

	system("Rscript myplotter.R");

That assumes Rscript is in the PATH, and that it works on Windows.  I'll 
assume you can figure out the details.

You might also consider making the C++ program write the R script, so 
bits can vary.  For instance, each iteration of the model could write 
out to a different data file, then call R from a new thread, so the R 
analysis stage doesn't interfere with the generation of the next 
iteration's results.  Remove the now-unwanted data file when system() 
returns, and end the thread.




More information about the R-help mailing list