tags:

views:

139

answers:

2

When R creates PDFs using pdf() it includes a CreationDate and a ModDate in the PDF. I have a number of such generated PDFs in an svn repository and the effect is that when figures are remade by R, even with the same data, they appear as modified (rightly so) to svn. What's the best way to get the two to play nicely together?

I could simply remove those lines from the PDFs outside of R, but this extra step is undesirable.
I could set the system time to some fixed value as part of the running the scripts, but this is even less desirable.
I could probably even convince svn to use a specialized diff which ignored changes on those lines, but that sounds like more trouble than it's worth.

A very pleasant solution would be if there were a way to prevent R putting those lines in the PDF file in the first place. I have a file system to tell me when files were created and modified thank-you-very-much, I don't need that info stored within the file as well.

+2  A: 

While this doesn't actually answer your question, it's usually best to exclude automatically generated files from source control, exactly for this reason.

Tal Pressman
+1  A: 

I agree with Tal, generated files should not be in version control.

In regards to your original question, I think the answer is no you can't stop R from doing that. I found no mention of such options in the R pdf help file, http://www.r-cookbook.com/rhelp/pdf.html

If you take a look at the pdf function inside of R (just execute 'pdf' without any parenthesis for a printout of the code) it actually creates the pdf file with a call to:

   .External(PDF, file, old$paper, old$family, old$encoding,
        old$bg, old$fg, old$width, old$height, old$pointsize,
        onefile, old$pagecentre, old$title, old$fonts, version[1L],
        version[2L], old$colormodel, old$useDingbats, old$useKerning)

No mention of the options you are looking for, so you are probably out of luck. Unless you want to track down the code R uses to generate a PDF and change it.

leif