This repository has been archived by the owner on Mar 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
/
README.Rmd
122 lines (79 loc) · 4.15 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
---
title: "ReporteRs"
output:
github_document
---
# Important note
![](https://upload.wikimedia.org/wikipedia/commons/6/66/Danger_radiation.svg)
ReporteRs has been rewritten. The new package is
[`officer`](https://cran.r-project.org/package=officer). FlexTable objects are
now implemented in package [`flextable`](https://CRAN.R-project.org/package=flextable).
Vector graphics are now implemented in package [`rvg`](https://CRAN.R-project.org/package=rvg) and
Native Microsoft charts can be produced with package [`mschart`](https://github.com/ardata-fr/mschart).
Please **use officer instead of ReporteRs**. There are issues
when using java > 1.8 that won't be fixed.
```{r, echo = FALSE, message=FALSE, warning=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
library(ReporteRs)
```
## Overview
`ReporteRs` is an R package for creating Microsoft Word and Powerpoint documents. It does not require any Microsoft component to be used. It runs on Windows, Linux, Unix and Mac OS systems. It is designed to automate reporting generation from R.
## Introduction
You can use the package as a tool for fast reporting and as a tool for reporting automation.
There are several features to let you format and present R outputs, for example:
* **Editable Vector Graphics**: let your readers modify and annotate plots.
* **Tables**: `FlexTable` objects let you format any complex table.
* **Text output**: format texts and paragraphs.
* Reuse of corporate **template document** (*.docx and *.pptx).
### Produce a document in few lines of codes
There are default templates and default values, it enables easy generation
of R outputs in few lines of codes.
Below a short R script:
```{r message=FALSE, eval=FALSE}
require( ggplot2 )
doc = docx( title = 'My document' )
doc = addTitle( doc , 'First 5 lines of iris', level = 1)
doc = addFlexTable( doc , vanilla.table(iris[1:5, ]) )
doc = addTitle( doc , 'ggplot2 example', level = 1)
myggplot = qplot(Sepal.Length, Petal.Length, data = iris, color = Species, size = Petal.Width )
doc = addPlot( doc = doc , fun = print, x = myggplot )
doc = addTitle( doc , 'Text example', level = 1)
doc = addParagraph( doc, 'My tailor is rich.', stylename = 'Normal' )
writeDoc( doc, "demo.docx" )
```
### Reporting automation
It lets you also create corporate documents, creation of complex tables,
pretty graphical rendering with a set of R functions.
To automate document generation only R code is necessary.
With Word and PowerPoint document, you can add contents from R but also replace
contents. By default, content is added at the end of the specified template document.
When generating Word document, bookmarks can be used to define locations of
replacements in the document. When generating PowerPoint document, slide indexes
can be used to define locations of slides to replace in the presentation.
## Installation
ReporteRs needs `rJava` with a java version >= 1.6 and <= 1.8 ; make sure you have an installed JRE.
`system("java -version")` should return *java version '1.6.0'* or greater.
Test your `rJava` installation with the following code, you should get your java version in a string:
```{r message=FALSE}
require(rJava)
.jinit()
.jcall('java.lang.System','S','getProperty','java.version')
```
### From Github
```{r eval=FALSE}
devtools::install_github('davidgohel/ReporteRsjars')
devtools::install_github('davidgohel/ReporteRs')
```
## Ressources
### Online documentation
The help pages are located at https://davidgohel.github.io/ReporteRs/.
### Getting help
This project is developped and maintained on my own time. In order to help me to maintain the
package, do not send me private emails if you only have questions about how to use the package.
Instead, visit Stackoverflow, `ReporteRs` has its own tag [Stackoverflow link](https://stackoverflow.com/questions/tagged/reporters)!
I usually read them and answer when possible.
### Bug reports
When you file a [bug report](https://github.com/davidgohel/ReporteRs/issues), please spend some time making it easy for me to follow and reproduce. The more time you spend on making the bug report coherent, the more time I can dedicate to investigate the bug as opposed to the bug report.