What is the difference between .Rpres and .md in presentation project?

I've just started a presentation using .Rpres, which is progressing really nicely, however, I'm a little confused as to why I have ended up with and presentation.md and a presentation.Rpres. I'm pretty sure they were both created immediately together, and both seem to stay in sync without me worrying about it.

The files look identical to me. Is there a file I should edit in preference, and the other feeds the preview? Is there one that I should commit to a git repo, and one that I shouldn't? Are there any differences I should understand that I (obviously) don't?

The .Rpres file is your primary file. When the file is saved, a new Markdown (.md) file is generated. This will look the same, with the significant exception that any R chunks in the original file will have been run, with the results inserted into the .md file.

In most (all?) other RMarkdown formats, the *.md file is deleted by default when the final html/pdf/docx/etc file is generated, so you won't see it for more than a second. In the RPresentation format, RStudio directly reads the .md file for the preview, so that's typically all you see unless you specifically save it as a web page or ask to view it in a browser.

Edit: As an aside, note that there are several other presentation formats under "New File" --> "R Markdown..." (and others that can be installed) if you decide the RPresentation format is too limiting. That appears to be an older format that lacks the bells and whistles of newer/more dynamic formats.

1 Like