Plotting functions from a C program using R
is it possible to plot functions from a C program using R? Is there a R C API available for plotting? Of course, it is possible to generate a R script from the C code and then call execute this generated script using the system comm开发者_Go百科and but I want to call R functions for plotting directly from the C code?
Thanks in advance, Jonas
You might like Rcpp
http://dirk.eddelbuettel.com/code/rcpp.html
EDIT: This might be useful as well: Call R plots from c++ using RInside/ Rcpp
As OneWhoisUnnamed already said, Rcpp and RInside may be of help if you want to take advantage of C++ rather than C.
Another nice example, completed after the post mentioned in the other answer, is this simple example of embedding R inside a simple Qt application: Qt does the widgets, R does the plotting---see this question for more, including a screenshot. This is now in the RInside SVN sources but not yet on CRAN.
You can interface with functions written in C using the .C function. One example of this is http://madison.byu.edu/bayes/gsnow.txt
The inline package may also be of help.
精彩评论