ReporteRs v0.8.9

Microsoft Word and PowerPoint Documents Generation

Create 'Microsoft Word' document (>=2007) and 'Microsoft PowerPoint' document (>=2007) from R. There are several features to let you format and present R outputs ; e.g. Editable Vector Graphics, functions for complex tables reporting, reuse of corporate template document. You can use the package as a tool for fast reporting and as a tool for reporting automation. The package does not require any installation of Microsoft product to be able to write Microsoft files.

Readme

ReporteRs R package

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.

Important note

ReporteRs will be maintained but will not evolve anymore. It has been rewritten with no java dependency:

  • The new package is officer.
  • FlexTable objects are now implemented in package flextable.
  • Vector graphics are now implemented in package rvg
  • Native Microsoft charts can be produced with package mschart

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:

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 ; 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:

require(rJava)
.jinit()
#> [1] 0
.jcall('java.lang.System','S','getProperty','java.version')
#> [1] "1.8.0_31"

Get CRAN version

install.packages('ReporteRs')

From Github

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! I usually read them and answer when possible.

Bug reports

When you file a bug report, 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.

Functions in ReporteRs

Name Description
Footnote Create a Footnote
RScript RScript object
CodeBlock Code Block Object
FlexCell Cell object for FlexTable
[<-.FlexRow modify FlexRow content
FlexRow Row object for FlexTable
ReporteRs-package ReporteRs: a package to create document from R
add.pot add a paraggraph to an existing set of paragraphs of text
[<-.FlexTable alter FlexTable content and format
FlexTable FlexTable creation
addDate Insert a date
addDocument Add an external document into a document object
addParagraph Add a paragraph into a document object
addPlot Add a plot into a document object
addFooter.pptx Insert a footer shape into a document pptx object
addFooterRow add footer in a FlexTable
addRScript Add R script into a document object
addSection Add a section into a document object
addFlexTable Insert a FlexTable into a document object
addFooter Insert a footer into a document object
addPageNumber.pptx Insert a page number shape into a document pptx object
addParagraph.Footnote Insert a paragraph into a Footnote object
as.html.FlexTable get HTML code from a FlexTable
as.html get HTML code
addHeaderRow add header in a FlexTable
addImage Add an external image into a document object
addTOC Add a table of contents into a document object
as.html.pot get HTML code from a pot
borderProperties border properties object
deleteBookmark delete a bookmark into a docx object
addPageBreak Add a page break into a document object
addPageNumber Insert a page number into a document object
as.FlexTable R tables as FlexTables
as.FlexTable.sessionInfo get FlexTable from a sessionInfo object
deleteBookmarkNextContent delete first content after a bookmark into a docx object
pot Piece of Text (formated text)
pot_img Image to be concatenate with pot object
print.Footnote print a Footnote
renderFlexTable FlexTable output for shiny
slide.layouts Get layout names of a document object
setFlexTableBorders change grid lines of a FlexTable
setFlexTableWidths set columns widths of a FlexTable
text_extract Simple Text Extraction From a Word Document
addTitle Add a title
list.settings format ordered and unordered lists
list_bookmarks List Bookmarks from a Word Document
parProperties Paragraph formatting properties
+.pot pot concatenation
setColumnsColors applies background colors to columns of a FlexTable
docx Create Microsoft Word document object representation
is.color color checking
map_title map titles styles
slide.layouts.pptx Get layout names of a pptx document
vanilla.table vanilla FlexTable shortcut
writeDoc Write a document object
setFlexTableBackgroundColors applies background colors to cells of a FlexTable
styles Get styles names of a document object
textProperties Text formatting properties
chprop Change a formatting properties object
colorProperties color properties object
pptx Create Microsoft PowerPoint document object representation
print.FlexTable Print FlexTables
addCodeBlock Add code block into a document object
addColumnBreak Add a column break into a section
addSlide Add a slide into a document object
addSubtitle Add a subtitle shape into a document object
office_web_viewer Office Web Viewer
setRowsColors applies background colors to rows of a FlexTable
setZebraStyle FlexTable rows zebra striping
toc.options Set TOC options
spanFlexTableColumns Span columns within rows
spanFlexTableRows Span rows within columns
cellProperties Cell formatting properties
chprop.FlexTable format FlexTable
knit_print.FlexTable FlexTable custom printing function for knitr
light.table light FlexTable shortcut
set_of_paragraphs Set of paragraphs of text
textNormal shortcuts for formatting properties
No Results!

Details

Type Package
License GPL-3
SystemRequirements java (>= 6)
URL https://davidgohel.github.io/ReporteRs
BugReports https://github.com/davidgohel/ReporteRs/issues
RoxygenNote 6.0.1.9000
NeedsCompilation no
Packaged 2018-01-08 09:57:44 UTC; davidgohel
Repository CRAN
Date/Publication 2018-01-08 14:07:55 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/ReporteRs)](http://www.rdocumentation.org/packages/ReporteRs)