produces a vector graphics output from R plot instructions and add the result in an Word document object produced by read_docx.
read_docx
body_add_vg(x, code, pos = "after", ...)
an rdocx object produced by officer::read_docx
rdocx
officer::read_docx
plot instructions
where to add the new element relative to the cursor, one of "after", "before", "on".
arguments passed on to dml_docx.
dml_docx
# NOT RUN { library(officer) x <- read_docx() x <- body_add_vg(x, code = barplot(1:5, col = 2:6) ) print(x, target = "vg.docx") # }
Run the code above in your browser using DataCamp Workspace