Friday, April 13, 2012

knitr Performance Report-Attempt 1

I get very excited about new R packages, but rarely is my excitement so fulfilled as with knitr.  Even with no skill, I have already been able to adapt the example Yihui Xie provides in his knitr Graphics Manual into a crude first version of a performance report that I could actually show clients and prospects.  Although this is far from production quality, two days of experimentation already has me to a level that assures me of the wonderful potential of combining the existing amazing R packages with knitr.  Before knitr, I do not believe I could have accomplished even this rough first draft.

If you have not played with MiKTeX before, you will need to use the Package Manager to install the xcolor and tufte-handout templates for this example to work properly.  MiKTeX is installed automatically with LyX as discussed in yesterday’s post Latex Allergy Cured by knitr.  If xcolor causes problems, then just change your repository to another repository.


knitr weaved with a little PerformanceAnalytics, lattice, and latticeExtra provides this first draft.  As always, thanks so much to the brilliant contributors that have made this possible.

R code in GIST:


  1. The Tufte class always looks appealing. You probably do not need \usepackage[buttonsize=1em]{animate} unless you are going to show animations in your PDF report :)

  2. Yihui is everywhere. Thanks again for everything, especially your unbelievable work. I was too afraid to remove anymore by posting time. I have removed that line. Will be fun to see what I can come up with.

  3. dartdog-anything similar in Python? Might be a good option for your reporting.

  4. I have google alerts and occasionally I look at twitter. It is just so important to name your software uniquely :)

    just FYI: I'm thinking on Python and other languages in knitr; its design did not actually limit it to R only.