Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R2PPT crashes R; are there alternatives to R2PPT?

Tags:

r

I am attempting to automate the insertion of JPEG images into Powerpoint. I have a macro done for that already, except using R would be infinitely better for my purposes.

The package R2PPT should do this, I understand. However, I cannot use it. For example, when I try to use PPT.Open, I understand I can do it two different ways by calling method = "rcom" or method = "RDCOMClient". Using the latter, R will always crash, sending an error report to windows. Using the former, it tells me I need to install statconnDCOM , before giving the error:

Error in PPT.Open(x) : attempt to apply non-function.

I cannot install statconnDCOM freely, as I wouldn't call this work non-commercial. So if there isn't a way to get around this issue, are there at least some free alternatives to R2PPT so that I can save several hours of manual work with a simple R code? If there is a way for me to use R2PPT, that would be ideal.

Thanks!

Edit: I'm using R version 2.15 and downloaded the most recent version of R2PPT. Powerpoint is 2007.

like image 443
Stephen Avatar asked Jun 13 '12 15:06

Stephen


2 Answers

Do you have administrative privileges on this machine? There is an issue with package RDCOMClient. It needs permissions to write file rdcom.err in the root of drive C:. If you don't have privileges to write to c:, there is a rather cumbersome workaround:

  1. Close R
  2. Create "c:\temp" folder if it doesn't exist.
  3. Locate on your hard drive file rdcomclient.dll. It usually placed in \R\library\RDCOMClient\libs\i386\ and in \R\library\RDCOMClient\libs\x64\ (you need to patch file which corresponds your Windows version - 32 bit or 64 bit). It's recommended to make backup copy of this files before patching.
  4. Open rdcomclient.dll in text editor (Notepad++, for example -http://notepad-plus-plus.org/)
  5. Find in file string c:\rdcom.err - it occurs only once.
  6. Go into overwrite mode (usually by pressing "Ins" key). It is very important that new path will have the same number of characters as original one. Type C:\temp\e.rr instead of c:\rdcom.err
  7. Save the file.

Now all should work fine.

like image 94
Gregory Demin Avatar answered Oct 25 '22 04:10

Gregory Demin


Arguably not an answer, but have you looked at using Sweave/knitr to render your presentations in LaTeX using something like Beamer? (As discussed on slide 17 here.)

Wouldn't help any with getting JPGs into a PowerPoint, but would certainly make putting R-output (numerical or graphical) into a presentation much easier!

Edit: if you want to use knitr (which I recommend), here's another reference.

like image 44
Jeff Allen Avatar answered Oct 25 '22 04:10

Jeff Allen