4

I wrote a Windows application in c++, i want to do data analysis in R but output the graphic to the window of my application, so i call a R routine within my application and i can send the handle of the window to R routine, but i do not know how to set the window as device of R's graphics.

the dev {grDevices} functions provide control over multiple graphics devices, but i think dev.set() or windows() did not work at this situation, what should i do ?

Thanks!

Sean
  • 100
  • 6

1 Answers1

5

You should implement a hook that redirects R graph to your application Window. I have not done it in c++ as the application, but the c# code to do it essentially is standard windows API.

It draws on hook code written by Dino Esposito around 2004.

http://rdotnet.codeplex.com/workitem/7

Dieter Menne
  • 10,076
  • 44
  • 67
  • thank you sir! that is greet, but there are something wrong in the demo, but does not matter i will do it with c++. – Sean Mar 01 '13 at 07:20
  • Yes, there is a version problem, because 1.5 is slightly different. However, the core part you are interested in is not affected. – Dieter Menne Mar 01 '13 at 07:48