addRScript: Add R script into a document object

Description Usage Arguments Details Value See Also Examples

View source: R/addRScript.R

Description

Add R script into a document object

Usage

1
2
3
4
5
6
7
8
addRScript(doc, rscript, file, text, ...)

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

## S3 method for class 'pptx'
addRScript(doc, rscript, file, text, append = FALSE, ...)

Arguments

doc

document object

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.

...

further arguments passed to other methods

bookmark

a character value ; id of the Word bookmark to replace by the script. optional.

par.properties

paragraph formatting properties of the paragraphs that contain rscript. An object of class parProperties

append

boolean default to FALSE. If TRUE, paragraphs will be appened in the current shape instead of beeing sent into a new shape. Paragraphs can only be appended on shape containing paragraphs (i.e. you can not add paragraphs after a FlexTable).

Details

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

Value

a document object

See Also

docx, pptx

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# docx example -----------
doc.filename = "ex_rscript.docx"
doc <- docx()
doc <- addRScript(doc, text = "x = rnorm(100)" )
writeDoc( doc, file = doc.filename )


# pptx example -----------
doc.filename = "ex_rscript.pptx"
doc <- pptx()
doc <- addSlide(doc, "Title and Content")
doc <- addRScript(doc, text = "x = rnorm(100)" )
writeDoc( doc, file = doc.filename )

ReporteRs documentation built on April 1, 2018, 12:06 p.m.