Quantcast
Viewing latest article 2
Browse Latest Browse All 3

Answer by Spacedman for how to run plot of R into C/C++?

You can run R using the system() call as you have, but you can't stick R functions on the command line like that.

What you can do is to write the R code to a file and call it with system("R CMD BATCH foo.R") - minimally:

main(){system("R CMD BATCH test.R");}

Now, by default the output graphics from R CMD BATCH go to a PDF file, so you need to open a graphics window and make the script pause if you want to see it.

Of course your test.R file could be written by your C code before it runs it, and you could keep it in a temporary directory or something.


Viewing latest article 2
Browse Latest Browse All 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>