[R] R integration with Microsoft Powerpoint

khobson@fd9ns01.okladot.state.ok.us khobson at fd9ns01.okladot.state.ok.us
Fri Jul 1 20:27:44 CEST 2005

Of course there are many ways to do it.

The user input could come from R dialogs via the tcltk package or the
Input() dialogs from VBA in Powerpoint.

I chose the output as PDF.  The R source code called cars.r, might go
something like:

pdf(file=paste(getwd(), "/", "cars.pdf", sep=""),
  width = 8.5, height = 11, onefile = TRUE, family = "Helvetica",
    title = "R Graphics Output", fonts = NULL, version = "1.1")
shell(paste(getwd(), "/", "cars.pdf", sep=""),wait=FALSE) #veiw PDF
stop("all done")

The cars.bat file, might go something like:

"C:\Program Files\R\rw2010\bin\R.exe" CMD BATCH c:\myfiles\r\cars.r
#Change the drives and paths to R.exe and the cars.r files.

The cars.bat file was played from PowerPoint by creating the object and
doubleclicking in the slideshow.  The are other ways to do it of course.
In PowerPoint, click the menu item Insert | Object | Create and browse to
and select the cars.r file.  I set the object as an icon and used the R.exe

VBA scripting to play the cars.bat file is not all that involved either.
mailto:khobson at odot.org
Kenneth Ray Hobson, P.E.
Oklahoma DOT - QA & IAS Manager
200 N.E. 21st Street
Oklahoma City, OK  73105-3204
(405) 522-4985, (405) 522-0552 fax

Visit our website at:

More information about the R-help mailing list