Friday 29 September 2017

R Literate Programming

Cited from the Book "Beginning Data Science in R"

The idea in literate programming is that the documentation of a program—in the sense of the documentation of how the program works and how algorithms and data structures in the program works—is written together with the code implementing the program.

Tools such as Javadoc and Roxygen (http://roxygen.org) do something similar.They have documentation of classes and methods written together with the code in the form of comments. Literate programming differs slightly from this. With Javadoc and Roxygen, the code is the primary document, and the documentation is comments added to it. With literate programming, the documentation is the primary text for humans to read and the code is part of this documentation, included where it falls naturally to have it. The computer code is extracted automatically from this document when the program runs.

But because the pipeline goes from R Markdown via knitr to Markdown and then via pandoc to the various output formats.

No comments:

Post a Comment