add_2ggplots: Add two ggplots into a document object

Description Usage Arguments Value Examples

View source: R/add_2ggplots.R

Description

Add two ggplots into a document object

Usage

1
2
3
4
5
6
7
8
9
add_2ggplots(
  mydoc,
  plot1,
  plot2,
  preprocessing = "",
  width = 3,
  height = 2.5,
  top = 2
)

Arguments

mydoc

A document object

plot1

An R code encoding the first ggplot

plot2

An R code encoding the second ggplot

preprocessing

preprocessing

width

plot width in inches

height

plot height in inches

top

top plot position in inches

Value

a document object

Examples

1
2
3
4
5
6
7
8
require(ggplot2)
require(magrittr)
require(officer)
require(rvg)
plot1 <- "ggplot(data = iris, aes(Sepal.Length, Petal.Length)) + geom_point()"
plot2 <- "ggplot(data = iris, aes(Sepal.Length, Petal.Length, color = Species)) + geom_point()"
read_pptx() %>% add_text(title="Two ggplots") %>% add_2ggplots(plot1=plot1,plot2=plot2)
read_docx() %>% add_text(title="Two ggplots") %>% add_2ggplots(plot1=plot1,plot2=plot2)

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