knitr: 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.

Version: 1.9
Depends: R (≥ 2.14.1)
Imports: evaluate (≥ 0.5.5), digest, formatR (≥ 1.0), highr (≥ 0.4), markdown (≥ 0.7.4), stringr (≥ 0.6), tools
Suggests: testit, rgl (≥ 0.95.1201), codetools, rmarkdown, XML, RCurl
Published: 2015-01-20
Author: Adam Vogt [ctb], Alastair Andrew [ctb], Alex Zvoleff [ctb], Andre Simon [ctb] (the CSS files under inst/themes/ were derived from the Highlight package, Ashley Manton [ctb], Brian Diggs [ctb], Cassio Pereira [ctb], David Robinson [ctb], Donald Arseneau [ctb, cph] (the framed package at inst/misc/framed.sty), Duncan Murdoch [ctb], Fabian Hirschmann [ctb], Fitch Simeon [ctb], Frank E Harrell Jr [ctb] (the Sweavel package at inst/misc/Sweavel.sty), Gregoire Detrez [ctb], Hadley Wickham [ctb], Heewon Jeon [ctb], Henrik Bengtsson [ctb], Jake Burkhead [ctb], James Manton [ctb], Jared Lander [ctb], Jeff Arnold [ctb], Jeremy Ashkenas [ctb, cph] (the CSS file at inst/misc/docco-classic.css), Jeremy Stephens [ctb], Jim Hester [ctb], Joe Cheng [ctb], Johannes Ranke [ctb], John Honaker [ctb], Jonathan Keane [ctb], JJ Allaire [ctb], Johan Toloe [ctb], Joseph Larmarange [ctb], Julien Barnier [ctb], Kevin K. Smith [ctb], Kirill Mueller [ctb], Kohske Takahashi [ctb], Michael Friendly [ctb], Michel Kuhlmann [ctb], Nacho Caballero [ctb], Nick Salkowski [ctb], Noam Ross [ctb], Qiang Li [ctb], Ramnath Vaidyanathan [ctb], Richard Cotton [ctb], Romain Francois [ctb], Scott Kostyshak [ctb], Sietse Brouwer [ctb], Simon de Bernard [ctb], Taiyun Wei [ctb], Thibaut Assus [ctb], Thibaut Lamadon [ctb], Thomas Leeper [ctb], Tom Torsney-Weir [ctb], Trevor Davis [ctb], Viktoras Veitas [ctb], Weicheng Zhu [ctb], Wush Wu [ctb], Yihui Xie [aut, cre]
Maintainer: Yihui Xie <xie at>
License: GPL-2 | GPL-3 [expanded from: GPL]
NeedsCompilation: no
Citation: knitr citation info
Materials: README NEWS
In views: ReproducibleResearch
CRAN checks: knitr results


Reference manual: knitr.pdf
Vignettes: Custom Print Methods
Not an Introduction to knitr
knitr Reference Card
Display Tables with the JavaScript Library DataTables
Templating with knit_expand()
An R HTML Vignette with knitr
An R Markdown Vignette with knitr
R Markdown with the Docco Classic Style
R Markdown with the Docco Linear Style
Package source: knitr_1.9.tar.gz
Windows binaries: r-devel:, r-release:, r-oldrel:
OS X Snow Leopard binaries: r-release: not available, r-oldrel: knitr_1.9.tgz
OS X Mavericks binaries: r-release: not available
Old sources: knitr archive

Reverse dependencies:

Reverse depends: BrailleR, EasyHTMLReport, OutbreakTools, PopGenReport, sdcMicro, SOMbrero, spThin, svSweave, tufterhandout
Reverse imports: assertive, BEQI2, confidence, COPASutils, flowr, gistr, Gmisc, htmlTable, interAdapt, kfigr, Kmisc, knitrBootstrap, ncappc, opencpu, optiRum, qmethod, radiant, rite, rmarkdown, rNMF, rtable, ucbthesis, userfriendlyscience
Reverse suggests: additivityTests, agridat, alm, AncestryMapper, anim.plots, Anthropometry, aoos, apex, aplore3, argparse, ARPobservation, aRxiv, ASMap, assertr, atsd, attribrisk, babar, BACA, BayesFactor, bayesGDS, BayesSingleSub, bbmle, bcpa, bdscale, BHMSMAfMRI, bio3d, biom, bizdays, BlandAltmanLeh, blocksdesign, bold, boostr, boxr, broom, BTYD, caretEnsemble, cati, causalsens, Causata, cda, checkpoint, ChemoSpec, chipPCR, choroplethr, circlize, classyfire, clifro, coenocliner, corrgram, corrplot, cosinor, Crossover, crunch, D2C, DAAG, datacheck, dataRetrieval, data.tree, decode, decompr, dendextend, dendsort, denovolyzeR, devtools, DiagrammeR, DLMtool, doRNG, dpcR, dplR, dplyr, drat, DVHmetrics, ecoengine, EcoSimR, EFDR, ega, EGRET, eHOF, elastic, enigma, enpls, ensurer, EpiModel, ergm, ESGtoolkit, eurostat, ExomeDepth, expp, FAOSTAT, fastR, fgpt, flexsurv, forestplot, formatR, fpCompare, fslr, FuzzyNumbers, gamclass, gapmap, gender, GetoptLong, ggdendro, ggenealogy, ggExtra, ggplot2, ggRandomForests, ggthemes, ggvis, glarma, glmm, glmnet, GlobalOptions, gmailr, GMCM, gMCP, googleVis, GOplot, gsDesign, gstudio, HarmonicRegression, haven, hazus, hddplot, heatmap3, HighDimOut, highr, HiveR, hot.deck, hpoPlot, hSDM, htmlwidgets, httr, HWxtest, hysteresis, iBUGS, icd9, inferference, intergraph, internetarchive, ISOpureR, itsadug, jiebaR, js, jsonlite, jtrans, kitagawa, knitcitations, knockoff, kyotil, lazyeval, lctools, LDAvis, learningr, lfe, linbin, lintr, lme4, localsolver, longpower, ltbayes, lubridate, lucid, magrittr, MALDIquant, MALDIquantForeign, mapmisc, markdown, MarkowitzR, matrixStats, MazamaSpatialUtils, mclust, mcprofile, medicalrisk, megaptera, memgene, metafolio, metaMix, mi, miniCRAN, mirt, mirtCAT, miscset, mkin, mongolite, monitoR, moonBook, MortalitySmooth, mosaic, mountainplot, MPSEM, MVN, mvnfast, mwaved, mycor, myTAI, nCal, nestedRanksTest, networkreporting, nicheROVER, NlsyLinks, NMF, NORTARA, nplr, nullabor, OLScurve, openssl, openxlsx, optparse, OrgMassSpecR, pacman, pairsD3, pander, PANICr, ParallelForest, pathdiagram, pbo, PDQutils, pez, phangorn, physiology, pitchRx, pkgmaker, planar, plotROC, plspm, polidata, pollstR, poppr, poweRlaw, PP, prospectr, PSAboot, psd, psData, pt, pumilioR, pvar, pxweb, qdap, qicharts, qqman, quanteda, quipu, R2admb, R6, raincpc, rainfreq, randomizr, rbhl, rbison, Rchoice, rclinicaltrials, Rcmdr, RcmdrPlugin.MA, RCMIP5, RcppOctave, rcrossref, Rd2roxygen, rDVR, readr, reconstructr, recosystem, REDCapR, RefManageR, refset, rentrez, reports, repra, REST, reval, rex, rfigshare, RGA, rgauges, rgbif, rgl, rglobi, rivr, rjade, rmongodb, rnbn, RNeXML, rngtools, rnoaa, RODBCext, rotations, roxygen2, rpf, rplexos, rplos, rprintf, RRreg, R.rsp, rsatscan, RSelenium, rsnps, RSNPset, rspa, rsunlight, rtype, rucm, rUnemploymentData, runjags, rvertnet, rvest, rWBclimate, rYoutheria, sadists, saeSim, saps, SCGLR, scrm, secr, secrdesign, secrlinear, sequences, seroincidence, servr, settings, SharpeR, shiny, shotGroups, signal.hsmm, SIMMS, simPH, simTool, sla, snht, snplist, snp.plotter, snpStatsWriter, softImpute, solr, sorvi, sotkanet, soundecology, spacetime, sparseHessianFD, sparseMVN, spca, spdep, spdynmod, spocc, sprinter, ss3sim, statar, survSNP, sweidnumbr, synlik, systemicrisk, syuzhet, tableone, tabplot, taxize, tester, texmex, textreg, TiddlyWikiR, tidyr, tigerstats, tikzDevice, tmap, tmle.npvi, TopKLists, trustOptim, turner, TurtleGraphics, UNF, urltools, USAboundaries, V8, vartors, vdmR, vegdata, Wats, WeightedCluster, wildlifeDI, wrassp, wsrf, XNomial, zooaRch, ztable
Reverse enhances: htmltools, networkD3, packrat, patchSynctex