Chapter 10 Reporting

Once you’ve gone through the hard work of collecting, cleaning, exploring, analyzing, and visualizing your data, you will often be faced with the question of how to best compile it and present it in a meaningful way. RMarkdown is a language which borrows the key syntax of Markdown for text formatting and allows for the use of R Code Snippets to generate graphics and other elements.

##RMarkdown template

##RPresentation template

##bookdown Bookdown is a R package that allows for the compilation of RMarkdown files into a variety of formats: PDF, HTML, LaTeX, and more. In fact, this document was generated using bookdown. This tool is particularly useful when you need the same content displayed in multiple formats.

For a great introduction to bookdown, take a look at Yihui Xie’s book “bookdown: Authoring Books and Technical Documents with R Markdown”.

As talked about in Xie’s book, the easiest way to get started on a bookdown project is to modify an existing bookdown document. Xie’s book has a demo instance that is a good start, but you can also take a look at this very repository and borrow some of the configuration options to start out with a book that is close in style and format to the document you will ultimately hope to deliver.

To generate content, you will create individual RMarkdown files for each chapter you wish to appear in your book. _bookdown.yml, _output.yml, and index.Rmd function as the configuration files for the document. _bookdown.yml is the place where you will go to set global settings about the built output. _output.yml is the place where you will go to set settings for the individual build methods (gitbook, pdf_book, epub, etc.). Finally, index.Rmd holds the header that eventually becomes the title page, and the document metadata. index.Rmd also holds global settings for the rendering of R code throughout the document in the build process. If you need a custom title page, see the TDIS Plan repository for a workaround.

Once you’ve finished your document, you should be able to pull the rendered document from the _book folder in the bookdown repository where you are drafting your document and use the output in whatever form you were expecting.