is_sunos <- tolower(Sys.info()[["sysname"]]) == "sunos"
options( "ReporteRs-fontsize" = 11 )
# plot example for docx -----
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 = "center")
)
writeDoc( doc, file = "ex_plot.docx" )
# plot example for pptx -----
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 = 4 )
if( !is_sunos ){
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 = "ex_plot.pptx" )
Run the code above in your browser using DataLab