Save graph from R as editable graphic in Excel

I am writing a GUI in R, and one of the functions I must implement is a button to save graphical output to an Excel sheet, ideally the graphic should be editable in Excel. I am trying to do this the following way:

  1. Save data used for graph to an .xlsx file
  2. Call a VBA scrip from R to recreate the graph in the .xlsx file.

I am stuck with step two, as I dont know how to execute a vba scrip from R. Any help is greatly appreciated.

Answers


I'd suggest setting up the sheet as a template and then create the graph and linking it to a specific area on the sheet or another sheet. Then when you need to create a new file, copy the template and add the data from R to Excel and then the graph will update with the new data.

If you want to use VBA then the method I generally use is StatconnDCOM + RCOM and just address Excel as a COM object.


Need Your Help

add google map marker with tap and hold gesture

monotouch xamarin google-maps-sdk-ios

I'm writing an app in Xamarin.IOS which has a controller that displays a Google Maps MapView, and I would like to add a marker when the user taps and holds over any point in the map

how to Insert data into a database by fetching data from another database?

c# asp.net sql vb.net crystal-reports

I have two database for example(A and B). I have already made a crystal report which take values from database 'B'. But now I want to upload this report to the Database 'A' with an unique id. When ...