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.