Skip to content
This repository was archived by the owner on Mar 23, 2020. It is now read-only.

Commit f94ecf2

Browse files
committed
doc
1 parent 2da5a3a commit f94ecf2

17 files changed

+121
-389
lines changed

R/00_AllGeneric.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ addParagraph = function(doc, value, ...){
211211
#' graphics if document is a docx and MS Word version used
212212
#' to open the document is 2007.
213213
#'
214-
#' See \code{\link{addParagraph.docx}} or \code{\link{addParagraph.pptx}}
215-
#' or \code{\link{addParagraph.html}} for examples.
214+
#' See \code{\link{addPlot.docx}} or \code{\link{addPlot.pptx}}
215+
#' or \code{\link{addPlot.html}} for examples.
216216
#' @export
217217
#' @seealso \code{\link{docx}}, \code{\link{addPlot.docx}}
218218
#' , \code{\link{pptx}}, \code{\link{addPlot.pptx}}

R/FlexTable.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#' @examples
3939
#' #START_TAG_TEST
4040
#' @example examples/FlexTableExample.R
41+
#' @example examples/agg.mtcars.FlexTable.R
4142
#' @example examples/STOP_TAG_TEST.R
4243
#' @seealso \code{\link{addHeaderRow}}, \code{\link{addFooterRow}}, \code{\link{setFlexTableWidths}}
4344
#' , \code{\link{alterFlexTable}}, \code{\link{setFlexTableBorders}}

R/addFlexTable.docx.R

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
#' , \code{\link{addTable.docx}}
1818
#' @examples
1919
#' #START_TAG_TEST
20+
#' doc.filename = "addFlexTable_example.docx"
2021
#' @example examples/docx.R
21-
#' @example examples/addTitledocx.R
22+
#' @example examples/addTitle1Level1.R
2223
#' @example examples/FlexTableExample.R
23-
#' @example examples/addFlexTable.docx.R
24-
#' @example examples/addTitledocx.R
24+
#' @example examples/addFlexTable.R
25+
#' @example examples/addTitle2Level1.R
2526
#' @example examples/agg.mtcars.FlexTable.R
26-
#' @example examples/addFlexTable.docx.R
27-
#' @example examples/writeDoc_addFlexTable_example_docx.R
27+
#' @example examples/addFlexTable.R
28+
#' @example examples/writeDoc_file.R
2829
#' @example examples/STOP_TAG_TEST.R
2930
#' @method addFlexTable docx
3031
#' @S3method addFlexTable docx

R/addFlexTable.html.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@
1212
#' , \code{\link{addTable.html}}
1313
#' @examples
1414
#' #START_TAG_TEST
15+
#' doc.dirname = "addTable_example"
16+
#' @example examples/html.R
17+
#' @example examples/addPage.R
18+
#' @example examples/addTitle1Level1.R
1519
#' @example examples/FlexTableExample.R
16-
#' @example examples/addFlexTable.html.R
20+
#' @example examples/addFlexTable.R
21+
#' @example examples/addTitle2Level1.R
22+
#' @example examples/agg.mtcars.FlexTable.R
23+
#' @example examples/addFlexTable.R
24+
#' @example examples/writeDoc_directory.R
1725
#' @example examples/STOP_TAG_TEST.R
1826
#' @method addFlexTable html
1927
#' @S3method addFlexTable html

R/addFlexTable.pptx.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,17 @@
1212
#' , \code{\link{addTable.pptx}}
1313
#' @examples
1414
#' #START_TAG_TEST
15+
#' doc.filename = "addFlexTable_example.pptx"
16+
#' @example examples/pptx.R
17+
#' @example examples/addSlide.R
18+
#' @example examples/addTitle1Level1.R
1519
#' @example examples/FlexTableExample.R
16-
#' @example examples/addFlexTable.pptx.R
20+
#' @example examples/addFlexTable.R
21+
#' @example examples/addSlide.R
22+
#' @example examples/addTitle2Level1.R
23+
#' @example examples/agg.mtcars.FlexTable.R
24+
#' @example examples/addFlexTable.R
25+
#' @example examples/writeDoc_file.R
1726
#' @example examples/STOP_TAG_TEST.R
1827
#' @method addFlexTable pptx
1928
#' @S3method addFlexTable pptx

R/addParagraph.docx.R

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,20 @@
1414
#' @return an object of class \code{"docx"}.
1515
#' @examples
1616
#' #START_TAG_TEST
17-
#' # Create a new document
18-
#' doc = docx( title = "title" )
19-
#'
20-
#' # Add "Hello World" into the document doc with
21-
#' # stylename "Normal". Run the following code to
22-
#' # see available stylenames:
23-
#' # \code{styles(doc)}
24-
#' doc = addParagraph(doc, "Hello Word!", "Normal");
25-
#'
26-
#' # Add into the document : "My tailor is rich" and "Cats and Dogs"
27-
#' # format some of the pieces of text
28-
#' pot1 = pot("My tailor", textProperties(color="red") ) + " is " + pot("rich"
29-
#' , textProperties(font.weight="bold") )
30-
#' pot2 = pot("Cats", textProperties(color="red") ) + " and " + pot("Dogs"
31-
#' , textProperties(color="blue") )
32-
#' my.pars = set_of_paragraphs( pot1, pot2 )
33-
#'
34-
#' # used style is "BulletList" so that paragraphs will be preceded by bullet points
35-
#' # ("BulletList" is an existing style in the defaut template docx of the package)
36-
#' doc = addParagraph(doc, my.pars, "BulletList");
37-
#'
38-
#' writeDoc( doc, "addParagraph_example.docx" )
39-
#' #STOP_TAG_TEST
17+
#' doc.filename = "addParagraph_example.docx"
18+
#' @example examples/docx.R
19+
#' @example examples/styles.docx.R
20+
#' @example examples/addTitle1Level1.R
21+
#' @example examples/addParagraph_hello_docx.R
22+
#' @example examples/addTitle2Level1.R
23+
#' @example examples/addParagraph_bullets_docx.R
24+
#' @example examples/addTitle3Level1.R
25+
#' @example examples/pot1_example.R
26+
#' @example examples/pot2_example.R
27+
#' @example examples/set_of_paragraphs_example.R
28+
#' @example examples/addParagraph_sop_docx.R
29+
#' @example examples/writeDoc_file.R
30+
#' @example examples/STOP_TAG_TEST.R
4031
#' @seealso \code{\link{docx}}, \code{\link{addParagraph}}
4132
#' @method addParagraph docx
4233
#' @S3method addParagraph docx

R/addParagraph.html.R

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,18 @@
1414
#' @return an object of class \code{"html"}.
1515
#' @examples
1616
#' #START_TAG_TEST
17-
#' # Create a new document
18-
#' doc = html( title = "title" )
19-
#'
20-
#' # add a page where to add R outputs with title 'page example 1'
21-
#' doc = addPage( doc, title = "page example 1" )
22-
#'
23-
#' # Add "Hello World" into the document doc
24-
#' doc = addParagraph(doc, "Hello Word!")
25-
#'
26-
#' # add a page where to add R outputs with title 'page example 2'
27-
#' doc = addPage( doc, title = "page example 2" )
28-
#'
29-
#' # Add into the document : "My tailor is rich" and "Cats and Dogs"
30-
#' # format some of the pieces of text
31-
#' pot1 = pot("My tailor", textProperties(color="red") ) + " is " + pot("rich"
32-
#' , textProperties(font.weight="bold") )
33-
#' pot2 = pot("Cats", textProperties(color="red") ) + " and " + pot("Dogs"
34-
#' , textProperties(color="blue") )
35-
#' my.pars = set_of_paragraphs( pot1, pot2 )
36-
#'
37-
#' # used parent.type = "ul" so that paragraphs will be preceded by bullet points
38-
#' doc = addParagraph(doc, my.pars, parent.type = "ul")
39-
#'
40-
#' # write the html object in a directory
41-
#' pages = writeDoc( doc, "addParagraph_example")
42-
#' print( pages ) # print filenames of generated html pages
43-
#' #STOP_TAG_TEST
17+
#' doc.dirname = "addParagraph_example"
18+
#' @example examples/html.R
19+
#' @example examples/addPage.R
20+
#' @example examples/addTitle1Level1.R
21+
#' @example examples/addParagraph_hello_nostylename.R
22+
#' @example examples/addTitle2Level1.R
23+
#' @example examples/pot1_example.R
24+
#' @example examples/pot2_example.R
25+
#' @example examples/set_of_paragraphs_example.R
26+
#' @example examples/addParagraph_sop_nostylename.R
27+
#' @example examples/writeDoc_directory.R
28+
#' @example examples/STOP_TAG_TEST.R
4429
#' @seealso \code{\link{docx}}, \code{\link{addTitle.docx}}
4530
#' , \code{\link{addTOC.docx}}, \code{\link{addParagraph}}
4631
#' @method addParagraph html

R/addParagraph.pptx.R

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,19 @@
99
#' @return an object of class \code{"pptx"}.
1010
#' @examples
1111
#' #START_TAG_TEST
12-
#' # Create a new document
13-
#' doc = pptx( )
14-
#' # Add a slide
15-
#' doc = addSlide( doc, slide.layout = "Title and Content" )
16-
#' # Add "Hello World" into the document doc
17-
#' doc = addParagraph(doc, "Hello Word!" )
18-
#'
19-
#' # Add a slide
20-
#' doc = addSlide( doc, slide.layout = "Title and Content" )
21-
22-
#' # Add into the document : "My tailor is rich" and "Cats and Dogs"
23-
#' # format some of the pieces of text
24-
#' pot1 = pot("My tailor", textProperties(color="red") ) + " is " + pot("rich"
25-
#' , textProperties(font.weight="bold") )
26-
#' pot2 = pot("Cats", textProperties(color="red") ) + " and " + pot("Dogs"
27-
#' , textProperties(color="blue") )
28-
#' my.pars = set_of_paragraphs( pot1, pot2 )
29-
#' doc = addParagraph(doc, my.pars )
30-
#' writeDoc( doc, "addParagraph_example.pptx")
31-
#' #STOP_TAG_TEST
12+
#' doc.filename = "addParagraph_example.pptx"
13+
#' @example examples/pptx.R
14+
#' @example examples/addSlide.R
15+
#' @example examples/addTitle1Level1.R
16+
#' @example examples/addParagraph_hello_nostylename.R
17+
#' @example examples/addSlide.R
18+
#' @example examples/addTitle2Level1.R
19+
#' @example examples/pot1_example.R
20+
#' @example examples/pot2_example.R
21+
#' @example examples/set_of_paragraphs_example.R
22+
#' @example examples/addParagraph_sop_nostylename.R
23+
#' @example examples/writeDoc_file.R
24+
#' @example examples/STOP_TAG_TEST.R
3225
#' @seealso \code{\link{pptx}}, \code{\link{addParagraph}}
3326
#' @method addParagraph pptx
3427
#' @S3method addParagraph pptx

R/addPlot.docx.R

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,17 @@
2424
#' @return an object of class \code{"docx"}.
2525
#' @examples
2626
#' #START_TAG_TEST
27-
#' require( ggplot2 )
28-
#'
29-
#' # Create a new document
30-
#' doc = docx( title = "title" )
31-
#'
32-
#' doc = addTitle( doc, "Plot 1", level = 1 )
33-
#' # Add a base plot - set vector.graphic to FALSE if Word version
34-
#' # used to read the file is <= 2007
35-
#' doc = addPlot( doc, fun = plot
36-
#' , x = rnorm( 100 )
37-
#' , y = rnorm (100 )
38-
#' , main = "base plot main title"
39-
#' , vector.graphic = TRUE
40-
#' , width = 5, height = 7
41-
#' , par.properties = parProperties(text.align = "left")
42-
#' )
43-
#'
44-
#' doc = addTitle( doc, "Plot 2", level = 1 )
45-
#' myplot = qplot(Sepal.Length, Petal.Length, data = iris, color = Species
46-
#' , size = Petal.Width, alpha = I(0.7))
47-
#' doc = addPlot( doc = doc
48-
#' , fun = print
49-
#' , x = myplot #this argument MUST be named, print is expecting argument 'x'
50-
#' )
51-
#'
52-
#' # Write the object in file "addPlot_example.docx"
53-
#' writeDoc( doc, "addPlot_example.docx" )
54-
#' #STOP_TAG_TEST
27+
#' doc.filename = "addPlot_example.docx"
28+
#' @example examples/docx.R
29+
#' @example examples/addTitle1Level1.R
30+
#' @example examples/addBasePlot_vg.R
31+
#' @example examples/addTitle2Level1.R
32+
#' @example examples/addggplot.R
33+
#' @example examples/writeDoc_file.R
34+
#' @example examples/STOP_TAG_TEST.R
5535
#' @seealso \code{\link{docx}}, \code{\link{addPlot}}
5636
#' @method addPlot docx
5737
#' @S3method addPlot docx
58-
5938
addPlot.docx = function(doc, fun
6039
, pointsize = getOption("ReporteRs-fontsize")
6140
, vector.graphic = F

R/addPlot.html.R

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' @description
44
#' Add a plot into the \code{html} object.
55
#'
6-
#' @param doc Object of class \code{"html"} where paragraph has to be added
6+
#' @param doc Object of class \code{html} where paragraph has to be added
77
#' @param fun plot function
88
#' @param width plot width in inches (default value is 6).
99
#' @param height plot height in inches (default value is 6).
@@ -16,44 +16,17 @@
1616
#' @return an object of class \code{"html"}.
1717
#' @examples
1818
#' #START_TAG_TEST
19-
#' require( ggplot2 )
20-
#' # Create a new document
21-
#' doc = html( title = "title" )
22-
#'
23-
#' # add a page where to add R plots with title 'Plots'
24-
#' doc = addPage( doc, title = "Plots" )
25-
#' # Add a base plot
26-
#' doc = addPlot( doc, fun = plot
27-
#' , x = rnorm( 100 )
28-
#' , y = rnorm (100 )
29-
#' , main = "base plot main title"
30-
#' )
31-
#' myplot = qplot(Sepal.Length, Petal.Length, data = iris, color = Species
32-
#' , size = Petal.Width, alpha = I(0.7))
33-
#' doc = addPlot( doc
34-
#' , print
35-
#' , width = 6, height = 7
36-
#' , x = myplot #this argument MUST be named, print is expecting argument 'x'
37-
#' )
38-
#'
39-
#' doc = addPlot( doc, print
40-
#' , width = 6, height = 7
41-
#' , x = myplot, vector.graphic = FALSE
42-
#' )
43-
#'
44-
#' ctl = c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
45-
#' trt = c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
46-
#' group = gl(2, 10, 20, labels = c("Ctl","Trt"))
47-
#' weight = c(ctl, trt)
48-
#' lm.D9 = lm(weight ~ group)
49-
#' doc = addPlot( doc, plot
50-
#' , width = 6, height = 7
51-
#' , x = lm.D9, vector.graphic = FALSE
52-
#' )
53-
#' # write the html object in a directory
54-
#' pages = writeDoc( doc, "addPlot_example")
55-
#' print( pages ) # print filenames of generated html pages
56-
#' #STOP_TAG_TEST
19+
#' doc.dirname = "addPlot_example"
20+
#' @example examples/html.R
21+
#' @example examples/addPage.R
22+
#' @example examples/addTitle1Level1.R
23+
#' @example examples/addBasePlot_vg.R
24+
#' @example examples/addTitle2Level1.R
25+
#' @example examples/addggplot.R
26+
#' @example examples/addTitle3Level1.R
27+
#' @example examples/addLMPlot.R
28+
#' @example examples/writeDoc_directory.R
29+
#' @example examples/STOP_TAG_TEST.R
5730
#' @seealso \code{\link{html}}, \code{\link{addPlot}}, \code{\link{add.plot.interactivity}}
5831
#' @method addPlot html
5932
#' @S3method addPlot html

R/addPlot.pptx.R

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,46 +20,20 @@
2020
#' of the PowerPoint template used to create the \code{pptx} object.
2121
#' @examples
2222
#' #START_TAG_TEST
23-
#' require( ggplot2 )
24-
#' # Create a new document
25-
#' doc = pptx( title = "title" )
26-
#'
27-
#' # add a slide with layout "Title and Content" then add plot
28-
#' doc = addSlide( doc, slide.layout = "Title and Content" )
29-
#' doc = addTitle( doc, "base plot" )
30-
#' # Add a base plot
31-
#' doc = addPlot( doc, fun = plot
32-
#' , x = rnorm( 100 )
33-
#' , y = rnorm (100 )
34-
#' , main = "base plot main title"
35-
#' )
36-
#'
37-
#' # add a slide with layout "Two Content" then add 2 plots
38-
#' doc = addSlide( doc, slide.layout = "Two Content" )
39-
#' doc = addTitle( doc, "2 ggplot2 examples" )
40-
#' doc = addPlot( doc
41-
#' , function(){
42-
#' print( qplot(Sepal.Length, Petal.Length, data = iris, color = Species
43-
#' , size = Petal.Width, alpha = I(0.7)) )
44-
#' }
45-
#' )
46-
#'
47-
#' myplot = qplot(Sepal.Length, Petal.Length, data = iris, color = Species
48-
#' , size = Petal.Width, alpha = I(0.7))
49-
#' doc = addPlot( doc
50-
#' , print
51-
#' , x = myplot #this argument MUST be named, print is expecting argument 'x'
52-
#' , vector.graphic = FALSE
53-
#' )
54-
#'
55-
#' # Write the object in file "addPlot_example.pptx"
56-
#' writeDoc( doc, "addPlot_example.pptx" )
57-
#' #STOP_TAG_TEST
23+
#' doc.filename = "addPlot_example.pptx"
24+
#' @example examples/pptx.R
25+
#' @example examples/addSlide.R
26+
#' @example examples/addTitle1NoLevel.R
27+
#' @example examples/addBasePlot_vg.R
28+
#' @example examples/addSlide.R
29+
#' @example examples/addTitle2NoLevel.R
30+
#' @example examples/addggplot.R
31+
#' @example examples/writeDoc_file.R
32+
#' @example examples/STOP_TAG_TEST.R
5833
#' @seealso \code{\link{pptx}}, \code{\link{addPlot}}
5934
#' @method addPlot pptx
6035
#' @S3method addPlot pptx
61-
62-
addPlot.pptx = function(doc, fun, pointsize=11
36+
addPlot.pptx = function(doc, fun, pointsize = 11
6337
, vector.graphic = TRUE, fontname = getOption("ReporteRs-default-font")
6438
, editable = TRUE
6539
, ... ) {

R/addTable.docx.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@
3535
#' @return an object of class \code{"docx"}.
3636
#' @examples
3737
#' #START_TAG_TEST
38+
#' doc.filename = "addTable_example.docx"
3839
#' @example examples/docx.R
39-
#' @example examples/addTitledocx.R
40+
#' @example examples/addTitle1Level1.R
4041
#' @example examples/simpleAddTable.R
41-
#' @example examples/addTitledocx.R
42+
#' @example examples/addTitle2Level1.R
4243
#' @example examples/spanAddTable.R
43-
#' @example examples/addTitledocx.R
44+
#' @example examples/addTitle3Level1.R
4445
#' @example examples/optionsDemoAddTable.R
45-
#' @example examples/writeDoc_addTable_example_docx.R
46+
#' @example examples/writeDoc_file.R
4647
#' @example examples/STOP_TAG_TEST.R
4748
#' @seealso \code{\link{docx}}, \code{\link{addTable}}, \code{\link{tableProperties}}
4849
#' @method addTable docx

0 commit comments

Comments
 (0)