ReporteRs (version 0.7.4)

addRScript.docx: Add R script into a docx object

Description

Add R script into a docx object.

Usage

# S3 method for 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
# NOT RUN {
#START_TAG_TEST
doc.filename = "addRScript_example.docx"
# Create a new document
doc = docx( title = "title" )

an_rscript = RScript( text = "ls()
x = rnorm(10)" )
doc = addRScript(doc, an_rscript )

doc = addPageBreak( doc )

doc = addRScript(doc, text = "ls()" )

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

Run the code above in your browser using DataCamp Workspace