R: Function to export currently active R plot to Powerpoint/Word/LibreOffice

You can try the eoffice package which also available in CRAN.


Just made a new CRAN package export that allows one to export an R plot in the currently active graphics device to either Powerpoint or Word (or LibreOffice Impress/Writer) in editable (DrawingML) vector format as a one-liner, with full support for transparency, etc, see https://cran.r-project.org/web/packages/export/index.html and demo at https://github.com/tomwenseleers/export

For example:

install.packages("export")
library(export)

Example to export lattice plot:

library(effects)
fit=lm(prestige ~ type + income*education, data=Prestige)
plot(Effect(c("income", "education"), fit),multiline=T, ci.style="bands")
graph2ppt(file="effect plot.pptx", width=7, height=5)

enter image description here

which after right clicking in PPT on "ungroup" can be seen to be nicely in vector format:

enter image description here

From Word or PPT these graphs also export perfectly to (vector format) PDF by using File...Save as...PDF, and it is much easier to make minor tweaks to the layout than is possible by editing directly in the PDF.

If the R Core or RStudio people would like to include this functionality please do - would be super handy for use in the classroom I think, given the dominance and widespread use of the Office suite!