21 Creating dynamic reports

 

This chapter covers

  • Publishing results to the web
  • Incorporating R results into Microsoft Word or Open Document reports
  • Creating dynamic reports in which changing the data changes the report
  • Creating publication-quality documents with R, Markdown, and LaTeX
  • Avoiding common R Markdown errors

In previous chapters you’ve accessed your data, cleaned it up, described its characteristics, modeled the relationships, and visualized the results. The next step is to

  1. Relax and perhaps go to Disney World.
  2. Communicate the results to others.

If you chose 1, please take me with you. If you chose 2, welcome to the real world.

Research doesn’t end when the last statistical analysis or graph is finished. You’ll almost always have to communicate the results to others. This means incorporating the analyses into a report of some kind.

There are three common report scenarios. In the first, you create a report that includes your code and the results so you can remember what you did six months from now. It’s easier to reconstruct what was done from a single comprehensive document than from a set of related files.

In the second scenario, you have to generate a report for a teacher, a supervisor, a client, a government agency, an internet audience, or a journal editor. Clarity and attractiveness matter, and the report may only need to be created once.

21.1 A template approach to reports

21.2 Creating a report with R and R Markdown

21.3 Creating a report with R and LaTeX

21.3.1 Creating a parameterized report

21.4 Avoiding common R Markdown problems

21.5 Going further

Summary