Type: Package
Title: Object Oriented R -> PowerPoint
Version: 0.1.0
Description: Provides a friendly, object oriented API for creating PowerPoint slide decks in R.
URL: https://mattle24.github.io/r2pptx/, https://github.com/mattle24/r2pptx
BugReports: https://github.com/mattle24/r2pptx/issues
License: GPL-3
Encoding: UTF-8
RoxygenNote: 7.1.1
Depends: methods, R (≥ 3.6.0)
Imports: glue, officer
Suggests: datasets, ggplot2, testthat (≥ 3.0.0), knitr, rmarkdown
Collate: 'location.R' 'generics.R' 'element.R' 'slide.R' 'presentation.R' 'methods.R' 'utils.R' 'zzz.R'
Config/testthat/edition: 3
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2021-09-08 17:06:00 UTC; matt
Author: Matt Lehman [aut, cre]
Maintainer: Matt Lehman <mhlehman24@gmail.com>
Repository: CRAN
Date/Publication: 2021-09-15 18:40:02 UTC

Add R2Ppptx slide

Description

Add an 'R2PptxSlide' object to something else compatible.

Usage

## S4 method for signature 'R2Pptx,R2PptxSlide'
e1 + e2

Arguments

e1

An object that a slide can be added to, such as an 'R2PptxPresentation', 'R2PptxSlide', or 'R2PptxSlideList'.

e2

'R2PptxSlide' object

Value

If e1 is an object of class R2PptxPresentation then returns an object of class R2PptxPresentation. Otherwise returns an object of class R2PptxSlideList


Add R2Ppptx slidelist

Description

Add an R2PptxSlideList object to a presentation.

Usage

## S4 method for signature 'R2PptxPresentation,R2PptxSlideList'
e1 + e2

Arguments

e1

R2PptxPresentation object

e2

R2PptxSlideList object

Value

An object of class R2PptxPresentation, which is the R2PptxPresentation object e1 with an additional slide, the R2pptxSlide object e2.


Add element to slide

Description

Add an R2PptxElement object to an R2PptxSlide object.

Usage

## S4 method for signature 'R2PptxSlide,R2PptxElement'
e1 + e2

Arguments

e1

R2PptxSlide object

e2

R2PptxElement object

Value

An object of class R2PptxSlide, which is e1 with an additional element e2


Add slide to slidelist

Description

Add slide to slidelist

Usage

## S4 method for signature 'R2PptxSlide,R2PptxSlideList'
e1 + e2

Arguments

e1

PR2PptxSlide object

e2

R2PptxSlideList object

Value

An object of class R2PptxSlideList which is the R2PptxSlideList list e1 with an additional slide which is e2.


Add slidelist to slidelist

Description

Add slidelist to slidelist

Usage

## S4 method for signature 'R2PptxSlideList,R2PptxSlideList'
e1 + e2

Arguments

e1

R2PptxSlideList object

e2

R2PptxSlideList object

Value

An object of class R2PptxSlideList which is e1 with additional slides (all the slides in e2).


Element

Description

An S4 An class to represent text, a flextable, an image, a ggplot2, etc we add to a slide.


Location

Description

A Location is used to place an element on a slide. For now this will just be a placeholder name, but eventually it could expand to be an arbitrary location


Presentation

Description

An S4 class to represent a PowerPoint presentation.

Slots

slides

list. List of 'R2PptxSlide' objects.

template_path

character. File path to the PowerPoint template used for this presentation.


Slide

Description

An S4 class to represent a PowerPoint slide

Slots

layout

character. Name of the PowerPoint layout to use for this slide.

elements

list. List of 'R2PptxElement' objects.


Slide list

Description

R2PptxSlideList is an S4 class to contain groups of R2PptxSlide objects that are not part of a presentation. It is meant to be used to create lists of slides and then be able to add the list easily to a presentation.

Slots

slides

list. A list of R2PptxSlide objects


Gets layout properties

Description

A thin wrapper around officer::plot_layout_properties() to get layouts properties for R2PpptxPresentation objects.

Usage

get_layout_properties(x, layout)

Arguments

x

R2PpptxPresentation object

layout

character. Name of the layout to see properties for.

Value

An object of class data.frame with fields for placeholder attributes and one row per placeholder element.


Get layouts

Description

A thin wrapper around officer::layout_summary() to get layouts for R2PpptxPresentation objects.

Usage

get_layouts(x)

Arguments

x

R2PpptxPresentation object

Value

An object of class data.frame with fields for the layout name and the name of the slide theme (master).


method to get slides

Description

method to get slides

Usage

## S4 method for signature 'R2PptxSlideList'
get_slides(x)

Arguments

x

R2PptxSlideList object

Value

List, a list of R2PptxSlide objects.


Get slide length

Description

Returns the number of elements in a slide

Usage

## S4 method for signature 'R2PptxSlide'
length(x)

## S4 method for signature 'R2PptxPresentation'
length(x)

Arguments

x

'R2PptxSlide' object

Value

Integer, number of elements in the R2PptxSlide object

Integer, the number of slides in the presentation.


New Element

Description

Make a new 'R2PptxElement'. Element represent text, a flextable, an image, a ggplot2, etc to add to a slide.

Usage

new_element(key, value)

Arguments

key

character. Name of the placeholder label for this element.

value

object. Object to put into a PowerPoint slide, eg text or a plot.

Value

An object of class R2PptxElement representing something to put on a slide.


New Presentation

Description

Make a new 'R2PptxPresentation'. Presentations represent PowerPoint decks.

Usage

new_presentation(
  template_path = getOption("default_pptx_template"),
  slides = list()
)

Arguments

template_path

character. Path of the file that has the PowerPoint template to use. Defaults to path set in 'options("default_pptx_template")'

slides

list. Optional. List of slides to initiate the presentation with.

Value

An object of class R2PptxPresentation representing a future PowerPoint presentation.


New slide

Description

Make a 'R2PptxSlide' object representing a PowerPoint slide.

Usage

new_slide(layout, elements = list())

Arguments

layout

character. Name of the PowerPoint layout to use for this slide.

elements

list. List of 'R2PptxElements' to initialize the slide with. Defaults to empty list.

Value

An object of class R2PptxSlide representing a future PowerPoint slide.


New slide list

Description

Make a R2PptxSlideList object representing a list of PowerPoint slides

Usage

new_slidelist(slides = list())

Arguments

slides

list. List of R2PptxSlide objects to initialize the list with. Defaults to empty list.

Value

An object of class R2PptxSlideList representing a list of R2pptxSlide object.


Plot layout

Description

A thin wrapper around officer::plot_layout_properties() to plot layouts for R2PpptxPresentation objects.

Usage

plot_layout(x, layout)

Arguments

x

R2PpptxPresentation object

layout

character. Name of the layout to see properties for.

Value

No return value, called for side effects


Get template path

Description

Get template path

Usage

template_path(x)

## S4 method for signature 'R2PptxPresentation'
template_path(x)

Arguments

x

object to get the template path for.

Value

Character, the file path this R2PptxPresentation points to.

Methods (by class)


Set template path

Description

Set template path

Usage

template_path(x) <- value

## S4 replacement method for signature 'R2PptxPresentation'
template_path(x) <- value

Arguments

x

object to set the template path of.

value

character. File path of the new template

Value

The R2PptxPresentation object x with the changed template path.

Functions


Write pptx

Description

Write an object to a '.pptx' file.

Usage

write_pptx(x, path)

## S4 method for signature 'R2PptxPresentation'
write_pptx(x, path)

Arguments

x

object

path

character. File path to write to.

Value

Returns the R2PptxPresentation object given to the function.

Methods (by class)