Chapter 1 Introduction

This book deals with reporting from R with the packages {officer}, {officedown}, {flextable}, {rvg} and {mschart}.

These packages are available from CRAN or from github in their development version.

These packages have been developed to facilitate the production of Word documents and PowerPoint presentations from and with R. It was written specifically to offer a competitive solution to SAS ODS for tabular and graphical reporting.

1.1 Package {officer}

{officer} is written to generate Word or PowerPoint documents, that’s all!

{rmarkdown} is a Literate Programming framework and tabular and graphical reporting is quite different from literate programming. If your goal is to produce content that is essentially composed of tables, graphs, tables of contents, {officer} may be the right solution. But if your goal is to write a lot of text in your document, it is highly recommended to prefer {officedown} to {officer}. {officedown} was written to take advantage of the benefits of {rmarkdown} and {officer}.

The {officer} package is ideal in cases such as:

  • producing reports from a shiny application
  • clinical reporting
  • the automation of reporting in compliance with the official corporate templates

1.2 Package {officedown}

The package facilitates the formatting of Microsoft Word documents produced by R Markdown documents.

The package brings some features of the “officer” package in R Markdown documents such as :

  • the ability to insert a paragraph with complex formatting,
  • the structuring of content into sections,
  • formatting of tables and lists according to a Word template,
  • the use of Word’s calculated fields for references and captions.

He is also adept at creating PowerPoint with R Markdown. It essentially allows to add editable vector graphics and to position several elements freely in a slide.

1.3 Package {flextable}

The flextable package provides a framework for easily create tables for reporting and publications. Functions are provided to let users create tables, modify and format their content and define their content.

Tables can be embedded within:

  • R Markdown documents with support for HTML, Word, PDF and PowerPoint documents.
  • Microsoft Word or PowerPoint documents with package officer.
  • PDF documents with package pagedown

Tables can also be rendered as R plots or graphic files (png, pdf and jpeg).

1.4 Package {rvg}

The package rvg brings an API to produce nice vector graphics that can be embedded in PowerPoint documents or Excel workbooks with officer.

1.5 Package {mschart}

The package mschart combined with officer can produce native office charts in PowerPoint and Word documents.

Its maintenance is interrupted but will be resumed later and will probably see a fairly substantial overhaul of the existing API.