Render R Presentation from the command line
Asked Answered
M

1

7

Is there a way to create an R presentation from the command line?

https://support.rstudio.com/hc/en-us/articles/200486468-Authoring-R-Presentations

I have the following R Presentation file stored in my_file.RPres file.

Title
========================================================
author: Me
date: Jan 9, 2015
transition: none
css: template.css

This is my presentation.

Is there any way to specify on rmarkdown::render(), knit(), pandoc(), or another R command, that this is an "R Presentation" .RPres file, and not ioslides_presentation, beamer_presentation, or slidy_presentation?

My .RPres file does not have any YAML metadata on the header, and the .css file was created based on the html file generated by RStudio with "Preview" and "Save As a Web page...".

Miraflores answered 13/1, 2015 at 19:36 Comment(6)
What do you mean by "knit(), pandoc(), and render() do not seem to render it"? Can you add your code please?Deettadeeyn
@Deettadeeyn Just edited the post to reflect your suggestion.Miraflores
Hmm it is kind of strange that there does not seem to be much documentation on manually creating the presentation files. If you're on a linux machine, you can read through the man page for pandoc (man pandoc in your terminal), which seemed to have a decent amount of information. Or create a default R Markdown presentation in RStudio and (possibly run options(verbose=TRUE) first) observe the system commands generated in the R Markdown window that pops up after clicking Knit HTML.Deettadeeyn
@Deettadeeyn .RPres files do not have a "Knit" option in RStudio. They have a "Preview" option instead. opts_knit$set(verbose = TRUE) does not change anything.Miraflores
No, they don't; what I meant was File -> New File... -> R Markdown -> Presentation -> HTML (isoslides) -> Ok, and then Knit HTML. I realize this isn't the same thing as creating a presentation from a .RPres file, but I'm guessing it might use the same underlying program(s) / process(es) to create the output file, just with different options / commandline flags. Maybe I'm wrong about that, but this is where I would start poking around given that I could not find any relevant documentation online.Deettadeeyn
@Deettadeeyn ioslides_presentation from .Rmd seem to be pretty different from R Presentations created from .Rpres. My .css is configured to work with the template from RPres. Thanks though!Miraflores
P
4

I asked this question in on RStudio Support Community page, and the 'official' answer was no. A colleague looked at the code on github and verified the method is only called from the drop down UI. Looks like to do this you would have to actually compile your own wrapper.

Phare answered 7/5, 2015 at 1:9 Comment(3)
Any news on this? It would be very convenient to automatically generate generate the presentation in docker. For example with gitlab CI/pages you could automatically update a presentation.Agenda
I ended up changing to RMarkdown / ioslides which was an easy change, and brought along lots of other benefits associated with Markdown and a complete overlap in the functionality I needed. The end result is pretty much what you described, although we didn't use Gitlab as the trigger, since Gitlab hosted the code, and we wanted updates when the data changed. RStudio Connect is a nice way to schedule updates of R Markdown docs.Phare
After reading more I found a post on RStudio's forum saying it is not possible. I will try to transition to xaringan.Agenda

© 2022 - 2024 — McMap. All rights reserved.