Re: [R] R integration with Microsoft Powerpoint

From: <khobson_at_fd9ns01.okladot.state.ok.us>
Date: Sat 02 Jul 2005 - 04:27:44 EST

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") plot(cars)
lines(lowess(cars))
graphics.off()
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 icon.

VBA scripting to play the cars.bat file is not all that involved either.



mailto:khobson@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:
http://www.okladot.state.ok.us/materials/materials.htm



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 02 04:30:04 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:11 EST