A First Look

The knitr package is a general-purpose literate programming engine — it supports document formats including Image, HTML, and Markdown (see Chapter 5), and programming languages such as R, Python, awk, C++, and shell scripts (Chapter 11). Before we get started, we need to install knitr in R. Then we will introduce the basic concepts with minimal examples. Finally, we will show how to generate reports quickly from pure R scripts, which can be useful for beginners who do not know anything about dynamic documents.

3.1    Setup

Since knitr is an R package, it can be installed from CRAN in the usual way in R:

Note here that dependencies ...

Get Dynamic Documents with R and knitr, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.