Learn R Programming

WordR (version 0.3.1)

addPlots: Read Word document with bookmarks and create other Word document with rendered plots in place.

Description

This function takes a list of functions creating plots and insert into Word document on places with correspondning bookmarks.

Usage

addPlots(docxIn, docxOut, Plots = list(), width = 6, height = 6,
  res = 300, style = NULL, debug = F, ...)

Arguments

docxIn

String of length one; path to Word file with bookmarks.

docxOut

String of length one; path for output Word file.

Plots

Named list of function creating plots to be inserted into the Word file

width

width of the plots in output in inches

height

height of the plots in output in inches

res

see res parameter in png

style

see style parameter in body_add_img

debug

Boolean of length one; If True then browser() is called at the beginning of the function

...

Parameters to be sent to other methods (png)

Value

Path to the rendered Word file if the operation was successfull.

Examples

Run this code
# NOT RUN {
library(ggplot2)
Plots<-list(plot1=function()plot(hp~wt,data=mtcars,col=cyl),
 plot2=function()print(ggplot(mtcars,aes(x=wt,y=hp,col=as.factor(cyl)))+geom_point()))
addPlots(
 paste(examplePath(),'templates/templatePlots.docx',sep = ''),
 paste(tempdir(),'/resultPlots.docx',sep = ''),
 Plots,height=4)

# }

Run the code above in your browser using DataLab