knitr v1.1

0

Monthly downloads

0th

Percentile

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 and reStructuredText. The patterns of code chunks and inline R expressions can be customized. 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 being added, and comments being 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 still supported as usual). 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). Currently LaTeX, HTML, Markdown and reST are supported, and other output formats can be supported by hook functions. 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 a specified R code fragment before or after a code chunk. The language in code chunks is not restricted to R only (there is simple support to Python and Awk, etc). Many features are borrowed from or inspired by Sweave, cacheSweave, pgfSweave, brew and decumar.

Functions in knitr

Name Description
opts_chunk Default and current chunk options
hook_movecode Some potentially useful document hooks
hook_plot_tex Default plot hooks for different output formats
kable Create tables in LaTeX, HTML, Markdown and reStructuredText
image_uri Encode an image file to a data URI
hook_rgl Built-in chunk hooks to extend knitr
dep_prev Make later chunks depend on previous chunks
knit2html Convert markdown to HTML using knit() and markdownToHTML()
dep_auto Build automatic dependencies among chunks
fig_path Path for figure files
knit_patterns Patterns to match and extract R code in a document
knit_theme Syntax highlighting themes
hook_plot_asciidoc Default plot hooks for different output formats
render_asciidoc Set output hooks for different output formats
knit_expand A simple macro preprocessor for templating purposes
read_rforge Read source code from R-Forge
clean_cache Clean cache files that are probably no longer needed
rst2pdf A wrapper for rst2pdf
set_header Set the header information
current_input Query the current input filename
rocco Knit R Markdown using the classic Docco style
pat_rnw Set regular expressions to read input documents
knitr-package A general-purpose tool for dynamic report generation in R
knit_global The global environment in which code chunks are evaluated
knit_engines Engines of other languages
all_patterns All built-in patterns
eclipse_theme Download and convert a theme from eclipsecolorthemes.org to CSS
opts_template Template for creating reusable chunk options
stitch Automatically create a report based on an R script and a template
Sweave2knitr Convert Sweave to knitr documents
imgur_upload Upload an image to imgur.com
vignette_engines Package vignette engines
spin_child Spin a child R script
read_chunk Read chunks from an external script
asis_output Mark an R object with a special class
rand_seed An unevaluated expression to return .Random.seed if exists
knit_meta Metadata about objects to be printed
set_parent Specify the parent document of child documents
opts_knit Options for the knitr package
all_labels Get all chunk labels in a document
knit_filter Spell check filter for source documents
engine_output An output wrapper for language engine output
write_bib Generate BibTeX bibliography databases for R packages
hook_ffmpeg_html Hooks to create animations in HTML output
knit2wp Knit an R Markdown document and post it to WordPress
knit_hooks Hooks for R code chunks, inline R code and output
knit_params Extract knit parameters from a document
knit Knit a document
knit_rd Knit package documentation
spin Spin goat's hair into wool
set_alias Set aliases for chunk options
inline_expr Wrap code using the inline R expression syntax
render_latex Set output hooks for different output formats
load_cache Load the cache database of a code chunk
fig_chunk Obtain the figure filenames for a chunk
knit_child Knit a child document
pandoc A Pandoc wrapper to convert Markdown documents to other formats
opts_hooks Hooks for code chunk options
wrap_rmd Wrap long lines in Rmd files
plot_crop Crop a plot (remove the edges) using PDFCrop or ImageMagick
knit2pdf Convert Rnw or Rrst files to PDF using knit() and texi2pdf() or rst2pdf()
render_html Set output hooks for different output formats
knit_print A custom printing function
knit_exit Exit knitting early
hook_pdfcrop Built-in chunk hooks to extend knitr
include_graphics Embed external images in knitr documents
hook_plot_html Default plot hooks for different output formats
knit_watch Watch an input file continuously and knit it when it is updated
knit_params_yaml Extract knit parameters from YAML text
combine_words Combine multiple words into a single string
include_url Embed a URL as an HTML iframe or a screenshot in knitr documents
No Results!

Last month downloads

Details

Type Package
Date 2013-02-16
License GPL
URL http://yihui.name/knitr/
BugReports https://github.com/yihui/knitr/issues
VignetteBuilder knitr
Collate 'package.R' 'utils-upload.R' 'plot.R' 'defaults.R' 'parser.R' 'cache.R' 'pattern.R' 'output.R' 'block.R' 'hooks.R' 'utils.R' 'themes.R' 'highlight-css.R' 'highlight-renderer.R' 'header.R' 'themes-eclipse.R' 'concordance.R' 'engine.R' 'citation.R' 'hooks-chunk.R' 'hooks-extra.R' 'hooks-latex.R' 'hooks-html.R' 'hooks-md.R' 'hooks-rst.R' 'spin.R' 'highlight.R' 'utils-base64.R' 'utils-rd2html.R' 'zzz.R' 'template.R' 'utils-sweave.R' 'utils-conversion.R' 'utils-vignettes.R'
Packaged 2013-02-16 15:27:47 UTC; yihui
NeedsCompilation no
Repository CRAN
Date/Publication 2013-02-16 17:53:36

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/knitr)](http://www.rdocumentation.org/packages/knitr)