# plot example for docx -----
doc.filename = "ex_plot.docx"
options( "ReporteRs-fontsize" = 11 )
doc = docx( )
doc = addPlot( doc, fun = function() barplot( 1:6, col = 2:7),
vector.graphic = TRUE, width = 5, height = 7,
par.properties = parProperties(text.align = "left")
)
writeDoc( doc, file = doc.filename )
# plot example for pptx -----
doc.filename = "ex_plot.pptx"
options( "ReporteRs-fontsize" = 11 )
doc = pptx( )
doc = addSlide( doc, slide.layout = "Title and Content" )
doc = addPlot( doc, fun = function() barplot( 1:6, col = 2:7),
vector.graphic = TRUE, width = 5, height = 7 )
doc = addPlot( doc, fun = function() barplot( 1:6, col = 2:7),
vector.graphic = FALSE,
offx = 7, offy = 0,
width = 3, height = 2
)
writeDoc( doc, file = doc.filename )
# plot example for bsdoc -----
doc.filename = "ex_plot/example.html"
options( "ReporteRs-fontsize" = 11 )
doc = bsdoc( )
doc = addPlot( doc, fun = function() barplot( 1:6, col = 2:7),
vector.graphic = TRUE, width = 5, height = 7,
par.properties = parProperties(text.align = "left")
)
writeDoc( doc, file = doc.filename )
Run the code above in your browser using DataLab