# docx example -----------
doc.filename = "ex_rscript.docx"
options( "ReporteRs-fontsize" = 10 )
doc <- docx( )
doc = addRScript(doc, text = "x = rnorm(100)
plot(density( x ) )" )
writeDoc( doc, file = doc.filename )
# pptx example -----------
doc.filename = "ex_rscript.pptx"
options( "ReporteRs-fontsize" = 24 )
doc = pptx( title = "title" )
# add a slide with layout "Title and Content"
doc = addSlide( doc, slide.layout = "Title and Content" )
doc = addTitle( doc, "Title example 1" )
doc = addRScript(doc, text = "x = rnorm(100)
plot(density( x ) )" )
writeDoc( doc, file = doc.filename )
# bsdoc example -----------
doc.filename = "ex_rscript/example.html"
options( "ReporteRs-fontsize" = 11 )
doc = bsdoc( )
doc = addRScript(doc, text = "x = rnorm(100)
plot(density( x ) )" )
writeDoc( doc, file = doc.filename )
Run the code above in your browser using DataLab