[R] PowerPoint graph insertion

Gabor Grothendieck ggrothendieck at gmail.com
Sat Sep 10 05:14:26 CEST 2005

On 9/9/05, Leif Kirschenbaum <leif at reflectivity.com> wrote:
> Yes:  I have Tufte's monograph on my desk. (along with 4 statistics texts)
> Yes:  I am not the biggest fan of PowerPoint.
> Yes:  I am using R to generate charts, plots, trends, etc. I have to summarize them each week.
>  When I consider how to organize this data my first thought is to generate an HTML file with links to the R-generated plots, which HTML file organizes the plots in the required order.
> However:
>  * Each week we annotate one PowerPoint slide in the weekly presentation with action items -- we don't only use PP as a presentation tool. This is convenient, as then the action items resulting from particular data trends are associated in a single document with the plots of the data trends.
>  * Other (non-R) users insert data into the weekly PP presentation: from other plotting software and images from various sources (microscope, SEM, TEM, etc.), which I cannot easily incorporate into a generated HTML file before-the-fact.
>  * I'm not sure how to create an HTML file which allows one to page forward and backward through it easily, as with PowerPoint (a minor point: and there is probably a way to write HTML to respond to such)
> So:
>  Can R insert plots into an existing PowerPoint presentation?
> (actually, I'd copy last week's presentation and then update with new plots)
>  I'll guess that it cannot, as there probably is not a Microsoft supplied interface (ODBC or otherwise) with PowerPoint as there is with Excel.

You can do it in VBA or you can do it in R using the RDCOMClient or 
rcom packages, either of which provide an interface to Microsoft COM 
objects, in general (these are not specific to any particular application).

I would first do it manually in PP with the macro recorder on so you can
see what VBA code is generated by the recorder.  Then you can
use that as a base for your VBA code or if you like you can translate it 
to R using either of the above mentioned R packages.

More information about the R-help mailing list