ABSTRACT

This chapter presents some concrete and complete examples to show how knitr works with real applications. For homework applications, R Markdown might be the preferred document format to work with due to its simplicity, and homework is usually not targeted at publication. As discussed by R. Gentleman and D. Temple Lang, R packages have the great potential of building and disseminating reproducible reports, besides their obvious functionality of providing computing routines. Specifically, R package vignettes can be an ideal format for writing reproducible reports, with other components of the package providing the infrastructure such as functions, unit tests, and datasets. An R package vignette is just like a paper, and the output is dynamically compiled from its source document during the package building process, i.e., R CMD build. The chapter introduces a few websites and blogs built upon knitr.