add_image | R Documentation |
Add plot into a document object
add_image( mydoc, x = NULL, preprocessing = "", left = 1, top = 2, width = 8, height = 5.5, units = "in", res = 300, format = "emf", ... )
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() |
a document object
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.