rpptx_document: Advanced R Markdown PowerPoint Format

Description Usage Arguments Value Examples

View source: R/rpptx_document.R

Description

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.

Usage

1
2
3
4
5
6
7
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)
}

if(run_ok && require("ggplot2")){
  skeleton <- system.file(package = "officedown",
    "rmarkdown/templates/powerpoint/skeleton/skeleton.Rmd")
  rmd_file <- tempfile(fileext = ".Rmd")
  file.copy(skeleton, to = rmd_file)

  pptx_file_2 <- tempfile(fileext = ".pptx")
  render(rmd_file, output_file = pptx_file_2)
}

Example output



officedown documentation built on April 6, 2021, 1:06 a.m.