Dynamic report generation in R: run code chunks inside documents
open sourceGPL-2.0-only OR GPL-3.0-onlyfree
knitr is an R package for dynamic report generation with literate programming: you write a document in LaTeX, HTML, Markdown, AsciiDoc or reStructuredText with code chunks in it, and knitr runs the code and weaves its output, tables and plots into the finished document. Inspired by Sweave, it folds the features of many add-on packages into one, with caching, hooks that control how input and output are written, high-quality graphics and support for code in languages other than R, such as Python and shell scripts.
Problems it solves
- generate a report from R code that updates when the data changes
- embed R code and its plots in a LaTeX or Markdown document
- make my statistical analysis reproducible in one document
- weave code output into HTML reports automatically
Features
- code chunks in LaTeX, HTML, Markdown, AsciiDoc and reStructuredText
- plots and output woven into the document
- caching
- output hooks
- chunks in R, Python, shell and other languages
Alternatives
The same job
These do what knitr does.
- Quarto An open-source scientific and technical publishing system
- JupyterLab Web-based environment for interactive and reproducible computing with Jupyter notebooks
- R Markdown Dynamic documents for R: code, output and prose in one file
