add_2plots: Add two plots into a document object

Description Usage Arguments Value Examples

View source: R/add_2plots.R

Description

Add two plots into a document object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
add_2plots(
  mydoc,
  plotstring1,
  plotstring2,
  preprocessing = "",
  plottype = "auto",
  width = NULL,
  height = NULL,
  echo = FALSE,
  top = 2
)

Arguments

mydoc

A document object

plotstring1

An R code string encoding the first plot

plotstring2

An R code string encoding the second plot

preprocessing

preprocessing

plottype

character One of c("auto","plot","ggplot")

width

plot width in inches

height

plot height in inches

echo

logical Whether or not show R code

top

top plot position in inches

Value

a document object

Examples

1
2
3
4
5
6
7
require(magrittr)
require(officer)
require(ggplot2)
plotstring1="plot(iris)"
plotstring2="ggplot(iris,aes(x=Sepal.Length,y=Sepal.Width))+geom_point()"
read_pptx() %>% add_text(title="Two plots") %>% add_2plots(plotstring1,plotstring2)
read_docx() %>% add_text(title="Two plots") %>% add_2plots(plotstring1,plotstring2)

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