Learn R Programming

rrtable (version 0.1.0)

add_2ggplots: Add two ggplots into a document object

Description

Add two ggplots into a document object

Usage

add_2ggplots(mydoc, plot1, plot2, 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

width

plot width in inches

height

plot height in inches

top

top plot position in inches

Value

a document object

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab