Format for converting from R Markdown to an MS PowerPoint document.

The function will allow you to specify the destination of your chunks in the output PowerPoint file. In this case, you must specify the layout and master for the layout you want to use, as well as the ph argument, which will allow you to specify the placeholder to be generated to place the result. Use the officer package to help you choose the identfiers to use.

This function also support Vector graphics output in an editable format (using package rvg). Wrap you R plot commands with function dml to use this graphic capability.

rpptx_document(
  base_format = "rmarkdown::powerpoint_presentation",
  layout = "Title and Content",
  master = "Office Theme",
  tcf = list(),
  ...
)

Arguments

base_format

a scalar character, format to be used as a base document for officedown. default to powerpoint_presentation but can also be powerpoint_presentation2 from bookdown

layout

default slide layout name to use

master

default master layout name where layout is located

tcf

default conditional formatting settings defined by officer::table_conditional_formatting()

...

arguments used by powerpoint_presentation

Value

R Markdown output format to pass to render

Examples

library(rmarkdown)
run_ok <- pandoc_available() && pandoc_version() > numeric_version("2.4")

if(run_ok){
  example <- system.file(package = "officedown",
    "examples/minimal_powerpoint.Rmd")
  rmd_file <- tempfile(fileext = ".Rmd")
  file.copy(example, to = rmd_file)

  pptx_file_1 <- tempfile(fileext = ".pptx")
  render(rmd_file, output_file = pptx_file_1)
}
#> 
#> 
#> processing file: file236c6014347b.Rmd
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |.....                                                                 |   7%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |..........                                                            |  14%
#> label: setup (with options) 
#> List of 1
#>  $ include: logi FALSE
#> 
#> 
  |                                                                            
  |...............                                                       |  21%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |....................                                                  |  29%
#> label: unnamed-chunk-1 (with options) 
#> List of 2
#>  $ layout: chr "Two Content"
#>  $ ph    :List of 1
#>   ..$ label: NULL
#>   ..- attr(*, "class")= chr [1:2] "location_left" "location_str"
#> 
#> 
  |                                                                            
  |.........................                                             |  36%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |..............................                                        |  43%
#> label: unnamed-chunk-2 (with options) 
#> List of 2
#>  $ layout: chr "Two Content"
#>  $ ph    :List of 1
#>   ..$ label: NULL
#>   ..- attr(*, "class")= chr [1:2] "location_right" "location_str"
#> 
#> 
  |                                                                            
  |...................................                                   |  50%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |........................................                              |  57%
#> label: plot1
#> 
  |                                                                            
  |.............................................                         |  64%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |..................................................                    |  71%
#> label: unnamed-chunk-3 (with options) 
#> List of 1
#>  $ ph:List of 12
#>   ..$ left    : num 2
#>   ..$ top     : num 2
#>   ..$ width   : num 2
#>   ..$ height  : num 2
#>   ..$ ph_label: chr ""
#>   ..$ ph      : chr NA
#>   ..$ bg      : NULL
#>   ..$ rotation: NULL
#>   ..$ ln      : NULL
#>   ..$ geom    : NULL
#>   ..$ fld_type: chr NA
#>   ..$ fld_id  : chr NA
#>   ..- attr(*, "class")= chr [1:2] "location_manual" "location_str"
#> 
#> 
  |                                                                            
  |.......................................................               |  79%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |............................................................          |  86%
#> label: unnamed-chunk-4 (with options) 
#> List of 1
#>  $ ph:List of 12
#>   ..$ left    : num 4
#>   ..$ top     : num 4
#>   ..$ width   : num 3
#>   ..$ height  : num 3
#>   ..$ ph_label: chr ""
#>   ..$ ph      : chr NA
#>   ..$ bg      : NULL
#>   ..$ rotation: NULL
#>   ..$ ln      : NULL
#>   ..$ geom    : NULL
#>   ..$ fld_type: chr NA
#>   ..$ fld_id  : chr NA
#>   ..- attr(*, "class")= chr [1:2] "location_manual" "location_str"
#> 
#> 
  |                                                                            
  |.................................................................     |  93%
#>   ordinary text without R code
#> 
#> 
  |                                                                            
  |......................................................................| 100%
#> label: unnamed-chunk-5
#> 
#> output file: file236c6014347b.knit.md
#> /usr/bin/pandoc +RTS -K512m -RTS file236c6014347b.knit.md --to pptx --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/Rtmpod7n2k/file236c559202bf.pptx --reference-doc /tmp/Rtmpod7n2k/file236c6d83a7ec.pptx 
#> 
#> Output created: /tmp/Rtmpod7n2k/file236c559202bf.pptx