Learn R Programming

ladder (version 0.0.1)

add_to_slides: Add Object to Slides

Description

Add Object to Slides

Usage

add_to_slides(object, presentation_id, on = NULL, object_id, overwrite, ...)

# S3 method for data.frame add_to_slides( object, presentation_id, on = NULL, object_id = new_id("table"), overwrite = FALSE, digits = NULL, ... )

# S3 method for flextable add_to_slides( object, presentation_id, on = NULL, object_id = new_id("table"), overwrite = FALSE, ... )

# S3 method for matrix add_to_slides( object, presentation_id, on = NULL, object_id = new_id("table"), overwrite = FALSE, digits = NULL, ... )

Value

A presentation object updated with the new object. This function is used for its side effect of adding an object to the slides. The returned object in R is mostly for inspection.

Arguments

object

An object to add to slides

presentation_id

The id from the Slides presentation

on

The id or number of the slide to add object to

object_id

A unique id for the new object on the slides

overwrite

If TRUE and an object with object_id exists it will deleted and replaced.

...

Other arguments used in methods

digits

the minimum number of significant digits, see format. If NULL getOption("digits") is used.

Details

A data.frame object is added as a table with the column names in bold as the first row. For other formatting use the flextable package and add_to_slides.flextable.

A flextable object is added with all formatting.

A matrix object is added as a table without any row or column names.

Examples

Run this code
if (FALSE) { # interactive()
## Add a data.frame
s <- choose_slides()
obj <- iris[1:5, ]
add_to_slides(obj, s, on = 1)
}
if (FALSE) { # interactive()
## Add a flextable
s <- choose_slides()
library(flextable)
ft <- flextable(iris[1:5, ])
ft <- theme_box(ft)
ft <- color(ft, i = 1:3, j = 1:2, "pink", part = "body")
ft <- autofit(ft)
add_to_slides(ft, s, on = 1)
}
if (FALSE) { # interactive()
## Add a matrix
s <- choose_slides()
obj <- cov(iris[, 1:4])
add_to_slides(obj, s, on = 1)
}

Run the code above in your browser using DataLab