knitr

Yihui Xie

Department of Statistics, Iowa State University

MBSW 2013 @ Ball State University

Warning

This is really a serious talk disguised in many animated GIF's.

So you cut-and-paste?


Then you'll be in trouble


The key idea

Report = Narrative + Code

A simple demo

Markdown + R

Motivation

  • TA: grading homework
  • instructor: painful to teach LaTeX
  • student: endless cut-and-paste

Changing just a tiny little bit in my LaTeX tabular


via

Sweave

Sweave is an extremely important contribution to reproducible research

Sweave ≈ LaTeX + R

the idea is fantastic, but when a student sees LaTeX

Change


same model, different appearance

Same idea, more choices

  • Authoring languages
    • LaTeX
    • HTML
    • Markdown
    • reStructuredText
    • ...
  • Computing languages
    • R
    • Python
    • shell scripts
    • C++ (Rcpp)
    • ...

Demo

  • local demos: R + Markdown, R + LaTeX, R + HTML
    • numeric output, graphics, syntax highlighting, code formatting, cache, language engines, ...
  • web demos

Applications

Learn knitr?

  • install.packages('knitr')
  • https://yihui.org/knitr
  • watch the video to get started

Acknowledgement

Questions?

image via