knitr::spin -- A more dynamic approach to dynamic documents - Peter DeWitt
Details
Building dynamic documents via literate programming is a critical part of responsible and reproducible science. Built on a literature programming framework, authoring .Rmd, .Rnw, .Rhtml, or other files, uses a markup language (markdown, LaTeX, html, ...) as the primary language for the file and the analysis/programming language (R, C++, SAS, ...) is a guest language. This paradigm has been extremely useful and durable since its formal introduction in the book "Literate Programming" Donald Knuth in 1984. R users should be at least aware of Sweave and knitr::knit, two R focused literate programming tools.
However, the common method of literate programming is, from the perspective of an analysis, backwards. As an analysis my primary language is the analysis language and the human readable report is nothing more than detailed code comments about the analysis script(s). knitr::spin is the tool needed to use literate programming paradigms where the analysis language is the primary language for the file(s) and the markup language is the guest language.
This talk will cover the following:
- Introduction to knitr::spin -- concept and syntax
- Simple reports -- that is analysis.R --> analysis.(docx|html|pdf)
- Non-trivial reports -- child documents and conditional code evaluation
