knitr v1.6


Monthly downloads



by Yihui Xie

A general-purpose package for dynamic report generation in R

This package provides a general-purpose tool for dynamic report generation in R, which can be used to deal with any type of (plain text) files, including Sweave, HTML, Markdown, reStructuredText, AsciiDoc, and Textile. R code is evaluated as if it were copied and pasted in an R terminal thanks to the evaluate package (e.g., we do not need to explicitly print() plots from ggplot2 or lattice). R code can be reformatted by the formatR package so that long lines are automatically wrapped, with indent and spaces added, and comments preserved. A simple caching mechanism is provided to cache results from computations for the first time and the computations will be skipped the next time. Almost all common graphics devices, including those in base R and add-on packages like Cairo, cairoDevice and tikzDevice, are built-in with this package and it is straightforward to switch between devices without writing any special functions. The width and height as well as alignment of plots in the output document can be specified in chunk options (the size of plots for graphics devices is also supported). Multiple plots can be recorded in a single code chunk, and it is also allowed to rearrange plots to the end of a chunk or just keep the last plot. Warnings, messages and errors are written in the output document by default (can be turned off). The large collection of hooks in this package makes it possible for the user to control almost everything in the R code input and output. Hooks can be used either to format the output or to run R code fragments before or after a code chunk. The language in code chunks is not restricted to R (there is simple support to Python and shell scripts, etc). Many features are borrowed from or inspired by Sweave, cacheSweave, pgfSweave, brew and decumar.

Functions in knitr

Name Description
hook_movecode Some potentially useful document hooks
Sweave2knitr Convert Sweave to knitr documents
hook_ffmpeg_html Hooks to create animations in HTML output
hook_rgl Built-in chunk hooks to extend knitr
knit_rd Knit package documentation
image_uri Encode an image file to a data URI
opts_chunk Default and current chunk options
hook_plot_asciidoc Default plot hooks for different output formats
all_patterns All built-in patterns
fig_path Path for figure files
render_asciidoc Set output hooks for different output formats
kable Create tables in LaTeX, HTML, Markdown and reStructuredText
imgur_upload Upload an image to
knit Knit a document
knit_expand A simple macro preprocessor for templating purposes
pandoc A Pandoc wrapper to convert Markdown documents to other formats
set_parent Specify the parent document of child documents
plot_crop Crop a plot (remove the edges) using PDFCrop or ImageMagick
set_alias Set aliases for chunk options
knit2wp Knit an R Markdown document and post it to WordPress
dep_prev Make later chunks depend on previous chunks
knit_hooks Hooks for R code chunks, inline R code and output
opts_template Template for creating reusable chunk options
all_labels Get all chunk labels in a document
pat_rnw Set regular expressions to read input documents
dep_auto Build automatic dependencies among chunks
read_chunk Read chunks from an external script
write_bib Generate BibTeX bibliography databases for R packages
spin Spin goat's hair into wool
knit_patterns Patterns to match and extract R code in a document
set_header Set the header information
eclipse_theme Download and convert a theme from to CSS
knit_global The global environment in which code chunks are evaluated
asis_output Mark an R object with a special class
knit2pdf Convert Rnw or Rrst files to PDF using knit() and texi2pdf() or rst2pdf()
stitch Automatically create a report based on an R script and a template
knitr-package A general-purpose tool for dynamic report generation in R
opts_knit Options for the knitr package
knit_theme Syntax highlighting themes
knit_meta Metadata about objects to be printed
knit2html Convert markdown to HTML using knit() and markdownToHTML()
read_rforge Read source code from R-Forge
rst2pdf A wrapper for rst2pdf
knit_print A custom printing function
knit_engines Engines of other languages
knit_child Knit a child document
knit_exit Exit knitting early
rand_seed An unevaluated expression to return .Random.seed if exists
rocco Knit R Markdown using the classic Docco style
current_input Query the current input filename
wrap_rmd Wrap long lines in Rmd files
No Results!

Last month downloads


Type Package
Date 2014-05-24
License GPL
VignetteBuilder knitr
Collate 'block.R' 'cache.R' 'citation.R' 'utils.R' 'plot.R' 'defaults.R' 'concordance.R' 'engine.R' 'themes.R' 'highlight.R' 'header.R' 'hooks-asciidoc.R' 'hooks-chunk.R' 'hooks-extra.R' 'hooks-html.R' 'hooks-latex.R' 'hooks-md.R' 'hooks-rst.R' 'hooks-textile.R' 'hooks.R' 'output.R' 'package.R' 'pandoc.R' 'parser.R' 'pattern.R' 'rocco.R' 'spin.R' 'table.R' 'template.R' 'themes-eclipse.R' 'utils-base64.R' 'utils-conversion.R' 'utils-rd2html.R' 'utils-sweave.R' 'utils-upload.R' 'utils-vignettes.R' 'zzz.R'
Packaged 2014-05-24 17:57:04 UTC; yihui
NeedsCompilation no
Repository CRAN
Date/Publication 2014-05-25 08:05:52

Include our badge in your README