Skip to content
a collection of knitr examples
TeX HTML Other
Latest commit 4b8e8b4 May 11, 2016 @yihui Merge pull request #46 from jimhester/master
Explicitly set repos when installing dependencies
Failed to load latest commit information.
.gitignore ignore .Rhistory Sep 21, 2015
001-minimal.Rmd an example for yihui/knitr#1022 Apr 19, 2015
001-minimal.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
002-minimal.Rnw use T1 font encoding to avoid possible weirdness like <> being weird … Oct 1, 2013
002-minimal.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
003-minimal.Rhtml use rawgit.com to display the html output Dec 24, 2014
003-minimal.html some minor css changes Mar 31, 2015
004-minimal.brew clarify the difference between brew and knitr's brew; closes #12 Jun 20, 2013
004-minimal.txt make Jun 20, 2013
005-latex.Rtex library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
005-latex.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
006-minimal.Rrst library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
006-minimal.rst changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
007-text-output.Rmd change deprecated formatR options and argument names Apr 19, 2015
007-text-output.md change deprecated formatR options and argument names Apr 19, 2015
008-outdec.Rnw add two examples about OutDec and ggplot2 geoms Jul 25, 2012
008-outdec.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
009-slides.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
009-slides.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
010-upload.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
010-upload.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
011-conditional-eval.Rnw move examples from gists to this repos for better management Aug 23, 2012
011-conditional-eval.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
012-line-breaks.Rmd formatR >= 1.3.2 will preserve line breaks Mar 21, 2016
012-line-breaks.md formatR >= 1.3.2 will preserve line breaks Mar 21, 2016
013-par.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
013-par.tex :: is syntax highlighted due to yihui/highr#3 Oct 23, 2014
014-sweave.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
014-sweave.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
015-listings.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
015-listings.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
016-device.Rnw move examples from gists to this repos for better management Aug 23, 2012
016-device.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
017-auto-dependson.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
017-auto-dependson.tex library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
018-fullfig-tikz.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
018-fullfig-tikz.tex remove cache, and re-make all examples (changes due to new figure nam… Oct 3, 2014
019-fig-caption.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
019-fig-caption.tex changes due to yihui/knitr#746 Jan 8, 2015
020-for-loop.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
020-for-loop.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
020-for-template.rnw an example of a for loop Aug 13, 2012
021-ggplot2-geoms.Rnw reduce the number of geoms to render in 021 (compilation time may be … Jan 1, 2016
021-ggplot2-geoms.tex reduce the number of geoms to render in 021 (compilation time may be … Jan 1, 2016
022-nothing.Rmd indent the haiku to preserve line breaks Aug 22, 2012
022-nothing.md indent the haiku to preserve line breaks Aug 23, 2012
023-engine-python.Rmd test the new feature introduced in yihui/knitr#963 Apr 12, 2015
023-engine-python.md test the new feature introduced in yihui/knitr#963 Apr 12, 2015
024-engine-awk.Rmd the file option was deprecated now Nov 2, 2012
024-engine-awk.md update the awk output Jan 8, 2016
025-engine-ruby.Rmd examples about awk, ruby and haskell Aug 8, 2012
025-engine-ruby.md removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
026-engine-haskell.Rmd use ghc for haskell Nov 2, 2012
026-engine-haskell.md removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
027-engine-bash.Rmd only wc the first 8 files so that changes in 027 will not update the … Jan 1, 2016
027-engine-bash.md only wc the first 8 files so that changes in 027 will not update the … Jan 1, 2016
028-engine-perl.Rmd a Perl example for yihui/knitr#406 Oct 24, 2012
028-engine-perl.md removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
029-engine-Rcpp.Rmd test the new feature introduced in yihui/knitr#963 Apr 12, 2015
029-engine-Rcpp.md not sure if R's RNG changed, or something in Rcpp changed Aug 3, 2015
030-landscape.Rnw use kable() instead of xtable, and no 'tiny' argument Jul 10, 2013
030-landscape.tex messages that are not identical to each other are no longer merged Jan 3, 2016
031-noindent.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
031-noindent.tex library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
032-persp.Rnw name and cache the persp chunk Aug 22, 2012
032-persp.tex remove cache, and re-make all examples (changes due to new figure nam… Oct 3, 2014
033-file-extension.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
033-file-extension.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
034-chinese.Rhtml make strip Nov 3, 2012
034-chinese.html some minor css changes Mar 31, 2015
035-optipng.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
035-optipng.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
036-latex-if.Rnw make strip Nov 3, 2012
036-latex-if.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
037-graphics-hyperlink.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
037-graphics-hyperlink.tex remove cache, and re-make all examples (changes due to new figure nam… Oct 3, 2014
038-output-width.Rnw should mention tidy=FALSE in the example Sep 15, 2013
038-output-width.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
039-merge.Rmd the new chunk option `collapse` Feb 6, 2014
039-merge.md removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
040-grid-table.Rnw recompile after #43 Jul 16, 2015
040-grid-table.tex recompile after #43 Jul 16, 2015
041-label-i-child.tpl one solution to http://stackoverflow.com/q/12095113/559676 Aug 26, 2012
041-label-i.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
041-label-i.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
042-highlight-matlab.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
042-highlight-matlab.tex changes due to yihui/knitr#1028 Apr 30, 2015
043-percent.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
043-percent.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
044-size.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
044-size.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
045-chunk-hook.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
045-chunk-hook.md library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
046-read-rforge.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
046-read-rforge.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
047-tikz-png.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
047-tikz-png.tex remove cache, and re-make all examples (changes due to new figure nam… Oct 3, 2014
048-cars-demo.Rnw use fontenc Oct 15, 2013
048-cars-demo.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
049-cars-demo.Rmd remove fig.align='center' from Rmd Jun 21, 2013
049-cars-demo.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
050-allowframebreaks.Rnw run donttest Apr 18, 2015
050-allowframebreaks.tex run donttest Apr 18, 2015
051-flowchart.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
051-flowchart.tex remove cache, and re-make all examples (changes due to new figure nam… Oct 3, 2014
052-suppress-output.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
052-suppress-output.md library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
053-beamer-only.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
053-beamer-only.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
054-loop-plots.Rmd draw plots inside a loop (http://stackoverflow.com/q/12935882/559676) Oct 26, 2012
054-loop-plots.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
055-multicols.Rnw a multicols example for http://yihui.name/knitr/options#comment-69545… Oct 29, 2012
055-multicols.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
056-huge-plot.Rmd make Nov 6, 2012
056-huge-plot.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
057-engine-dot.Rmd cache the graphviz example Nov 20, 2013
057-engine-dot.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
058-engine-tikz.Rmd make Nov 7, 2012
058-engine-tikz.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
059-tikz.Rnw update the repo for tikzDevice Nov 3, 2013
059-tikz.tex remove cache, and re-make all examples (changes due to new figure nam… Oct 3, 2014
060-engine-sas.Rmd I've just added a '%' before "put", double quotes instead of single q… Dec 18, 2013
060-engine-sas.md removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
061-bash-variable.Rmd an example of bash variables being passed from R Nov 12, 2012
061-bash-variable.md removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
062-chunk-wrapper.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
062-chunk-wrapper.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
062-chunk-wrapper.md library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
062-chunk-wrapper.tex library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
063-html5-figure.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
063-html5-figure.md changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
064-bib-plot.Rnw use bibliography citations in plots (with tikzDevice) Nov 20, 2012
064-bib-plot.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
065-rmd-chunk.Rmd another way to write a literal code chunk Sep 5, 2014
065-rmd-chunk.md another way to write a literal code chunk Sep 5, 2014
066-listings-breaklines.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
066-listings-breaklines.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
067-graphics-options.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
067-graphics-options.tex update example output Mar 2, 2016
068-beamer-simple.Rnw a minimal example of beamer Dec 5, 2012
068-beamer-simple.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
069-for-loop.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
069-for-loop.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
069-for-template.rnw an example contributed by Gil Tomás: use for-loop to knit templates Dec 10, 2012
070-caption-num.Rmd an example of figure numbers for http://stackoverflow.com/q/13848137/… Dec 12, 2012
070-caption-num.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
071-cleveref-examples.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
071-cleveref-examples.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
072-latex-reference.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
072-latex-reference.tex changes due to yihui/knitr#746 Jan 8, 2015
073-code-appendix.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
073-code-appendix.tex library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
074-example-environment.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
074-example-environment.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
075-knit-expand.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
075-knit-expand.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
075-template.rnw knit_expand(): a better template example than examples 020 and 041 (y… Jan 2, 2013
076-chinese-gb2312.TEX removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
076-chinese-gb2312.rnw how about inline R code containing chinese chars? Jan 16, 2013
077-wrap-output.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
077-wrap-output.md library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
078-chinese-big5.ctx removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
078-chinese-big5.rnw update the big5 example; added a chunk tidy=FALSE and inline code Jan 16, 2013
079-eval-echo.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
079-eval-echo.md library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
080-engine-coffeescript.Rmd an example of evaluating coffee code instead of printing JavaScript (y… Jul 29, 2014
080-engine-coffeescript.md an example of evaluating coffee code instead of printing JavaScript (y… Jul 29, 2014
081-hello-chinese.lyx somehow there is a problem with ctex again; need to deal with \nobrea… May 30, 2013
082-sweave-color.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
082-sweave-color.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
083-ggplot2-reference.Rmd suppress the message (I don't know why it appears on Travis but not o… Apr 26, 2015
083-ggplot2-reference.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
084-pandoc-more.bib an example for the pandoc() function Mar 5, 2013
084-pandoc.R rename the 'format' field to 't' (yihui/knitr#697) Jan 24, 2014
084-pandoc.Rmd an example for the pandoc() function Mar 5, 2013
084-pandoc.bib an example for the pandoc() function Mar 5, 2013
084-pandoc.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
084-pandoc.pandoc rename the 'format' field to 't' (yihui/knitr#697) Jan 24, 2014
085-pdfcrop.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
085-pdfcrop.tex remove cache, and re-make all examples (changes due to new figure nam… Oct 3, 2014
086-xtable-examples.Rnw remove xtable comments Apr 5, 2013
086-xtable-examples.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
087-child-example-child.rnw newlines at the end of files Apr 5, 2013
087-child-example.Rnw newlines at the end of files Apr 6, 2013
087-child-example.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
088-pandoc-embedded.R an example for yihui/knitr#547 Jul 1, 2013
088-pandoc-embedded.Rmd rename format to t Jan 27, 2014
088-pandoc-embedded.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
089-minimal.Rasciidoc add an asciidoc example for yihui/knitr#510 Apr 14, 2013
089-minimal.txt opts_knit$get('base.url') is now used in R AsciiDoc Apr 18, 2015
090-engine-c.Rmd the C engine example Jun 7, 2013
090-engine-c.md removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
091-knitr-table.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
091-knitr-table.tex new lines added due to yihui/knitr#861 Oct 23, 2014
092-latex-rgl.Rnw hook_rgl was moved to the rgl package May 6, 2015
092-latex-rgl.tex hook_rgl was moved to the rglwidget package Dec 10, 2015
093-knitr-asy.Rmd library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
093-knitr-asy.md changes due to the removal of the trailing white space for yihui/knit… Jan 1, 2016
094-purl.R changes due to yihui/knitr@f8c9726 Dec 29, 2014
094-purl.Rmd forgot to add an example for purl=FALSE Jun 21, 2013
094-purl.md removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
095-pandoc-header.Rmd an example of saving the chunk to a file Jul 10, 2013
095-pandoc-header.md removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
096-knit-exit.Rmd an example of knit_exit() (yihui/knitr#524) Jul 11, 2013
096-knit-exit.md an example of knit_exit() (yihui/knitr#524) Jul 12, 2013
097-Hmisc-scale.Rnw scale box applied to a table Jul 31, 2013
097-Hmisc-scale.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
098-highlight-python.Rnw an example for #495 Aug 7, 2013
098-highlight-python.tex a change due to yihui/knitr#1119 Dec 27, 2015
099-include-graphics.Rmd move dpi=NA from the chunk option to include_graphics() Apr 26, 2016
099-include-graphics.md move dpi=NA from the chunk option to include_graphics() Apr 26, 2016
100-alltt-verbatim.Rnw library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
100-alltt-verbatim.tex library(knitr), in case users compile these examples with rmarkdown, … Aug 14, 2014
101-cache-levels.Rmd the typo discovered in #32 May 19, 2014
101-cache-levels.md more changes due to the trailing space removal Jan 1, 2016
102-stitch-test.R add a chunk option to the stitch example Oct 23, 2014
102-stitch.R examples for stitch() Aug 31, 2013
103-move-float.Rnw an example for Michael Friendly: move code out of the floats Sep 7, 2013
103-move-float.tex new lines added due to yihui/knitr#861 Oct 23, 2014
104-subfigure.Rnw an example for subfigure: http://stackoverflow.com/q/18724254/559676 Sep 10, 2013
104-subfigure.tex changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
105-minimal.Rtextile add a textile example for yihui/knitr#623 Oct 26, 2013
105-minimal.textile changes due to 1) the naming scheme of figures has changed (always ch… Oct 3, 2014
106-polyglot.Rmd get rid of the paths of runtimes in the output; write them in message… Nov 1, 2013
106-polyglot.md removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
107-inline-linebreak.Rmd example for inline expression spanning several lines Nov 5, 2013
107-inline-linebreak.md example for inline expression spanning several lines Nov 5, 2013
108-animation-scianimator.Rmd there is already a 107; rename to 108 Nov 10, 2013
108-animation-scianimator.md changes due to yihui/knitr#1014 Apr 18, 2015
109-longstrings.Rnw rename the longstring example, and tweaked it Dec 9, 2013
109-longstrings.tex removal of some blank lines due to the major change in yihui/knitr@2b… Apr 13, 2014
110-rmarkdown-landscape.Rmd landscape PDF Jun 23, 2014
110-rmarkdown-landscape.md landscape PDF Jun 23, 2014
111-engine-fortran.Rmd no timing, otherwise it brings bogus diff in git Jul 6, 2014
111-engine-fortran.md no timing, otherwise it brings bogus diff in git Jul 7, 2014
112-yaml-in-child-child.rmd bugfix Oct 17, 2014
112-yaml-in-child.Rmd RStudio -> rmarkdown Oct 17, 2014
112-yaml-in-child.md the correct output for #36 after fixing yihui/knitr#862 Oct 22, 2014
113-externalization.Rmd add a quick example for http://yihui.name/knitr/demo/externalization/ Dec 24, 2014
113-externalization.md add a quick example for http://yihui.name/knitr/demo/externalization/ Dec 25, 2014
113-foo.R add a quick example for http://yihui.name/knitr/demo/externalization/ Dec 25, 2014
114-load-cache.Rmd an example to illustrate load_cache() (yihui/knitr#868) Dec 25, 2014
114-load-cache.md an example to illustrate load_cache() (yihui/knitr#868) Dec 25, 2014
Makefile Explicitly set repos when installing dependencies May 11, 2016
R-packages install hexbin for ggplot2 Dec 27, 2015
k no need to set base.dir now; I have moved the repo to Dropbox Oct 3, 2014
knitall just ignore 059 Mar 3, 2016
knitr-examples.Rproj add the RStudio project file Jan 24, 2014
readme.md update README Nov 4, 2013

readme.md

knitr examples

This repository is a collection of knitr examples. It is both for my own test purpose and for other knitters to learn about this package.

For each input file, there is an output file, e.g. 001-minimal.Rmd corresponds to 001-minimal.md.

Integration tests

The examples can be checked automatically with Travis CI. To enable:

  • Fork this repository and knitr
  • Enable Travis CI for your knitrfork
  • In your knitr fork, create a branch with the same name as in your knitr-examples fork
    • You can also choose to work in master in both repositories

Now, each time you push to knitr, the examples are compiled and checked for differences with the expected result. Use this for major changes to knitr to avoid undesired side effects.

Something went wrong with that request. Please try again.