add_image: Add plot into a document object

Description Usage Arguments Value Examples

View source: R/image2pptx.R

Description

Add plot into a document object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
add_image(
  mydoc,
  x = NULL,
  preprocessing = "",
  left = 1,
  top = 2,
  width = 8,
  height = 5.5,
  units = "in",
  res = 300,
  format = "emf",
  ...
)

Arguments

mydoc

A document object

x

An string of R code encoding plot

preprocessing

A string of R code or ""

left

left margin

top

top margin

width

the width of the device.

height

the height of the device.

units

The units in which height and width are given. Can be px (pixels, the default), in (inches), cm or mm.

res

The nominal resolution in ppi which will be recorded in the bitmap file, if a positive integer. Also used for units other than the default, and to convert points to pixels.

format

plot format

...

additional arguments passed to png()

Value

a document object

Examples

1
2
3
4
5
6
require(officer)
require(rrtable)
require(magrittr)
require(ggplot2)
read_pptx() %>% add_text(title="Add image") %>% add_image("plot(iris)")
read_docx() %>% add_text(title="Add image") %>% add_image("plot(1:10)",format="png")

rrtable documentation built on April 2, 2020, 5:09 p.m.