ReporteRs (version 0.7.7)

addRScript.docx: Add R script into a docx object

Description

Add R script into a docx object.

Usage

## S3 method for class 'docx':
addRScript(doc, rscript, file, text, bookmark,
  par.properties = parProperties(), ...)

Arguments

doc
Object of class docx where expressions have to be added
rscript
an object of class RScript. Not used if file or text is provided.
file
R script file. Not used if text or rscript is provided.
text
character vector. The text to parse. Not used if file or rscript is provided.
bookmark
a character value ; id of the Word bookmark to replace by the script. optional. See bookmark.
par.properties
paragraph formatting properties of the paragraphs that contain rscript. An object of class parProperties
...
further arguments, not used.

Value

  • an object of class docx.

Details

You have to one of the following argument: file or text or rscript.

See Also

docx, addRScript, bookmark

Examples

Run this code
doc.filename = "addRScript_example.docx"

# set default font size to 10
options( "ReporteRs-fontsize" = 10 )

doc = docx( )
doc = addRScript(doc, text = "x = rnorm(100)
plot(density( x ) )" )

# Write the object
writeDoc( doc, file = doc.filename )

Run the code above in your browser using DataLab