Creating a Quick Report with knitr, xtable, R Markdown, Pandoc (and some OpenBLAS Benchmark Results)

August 15, 2013

(This article was first published on Blend it like a Bayesian!, and kindly contributed to R-bloggers)

To cut a long story short, I always wanted to write professional-looking documents (technical reports and potentially my thesis) with R codes. No more copy and paste. No more Microsoft Word. At the same time, I don’t feel comfortable with LaTeX. Somehow I found a workaround with knitr, xtable, R Markdown and Pandoc.

I must say that my solution is far from perfect as I haven’t mastered the document layout configuration yet. But I did manage to get some satisfactory results (well, from a seasoned MS Word user’s point of view) with minimal R Markdown, xtable and knitr codes.

Instead of showing some dummy results, I created a simple report on R-25 benchmark results with two versions of OpenBLAS (ver. 0.2.6-1: the default, 2-threaded version on my Linux and ver. 0.2.8-1: the latest, multi-threaded version which had been made available recently). In short, the latest OpenBLAS performed slightly better in most of the R-25 tests but two. For more details, download the full pdf here.

The code-generated report looks like this …

… which I think is pretty enough for a quick report. When I look at the source R Markdown file which is nothing but geeky plain text (see below), I just can’t find words to describe the awesomeness of knitr + xtable + pandoc. Thank you very much Yihui, RStudio team, David, Charles and John.

The codes are available on Github. This was my first attempt to code a report, the code structure isn’t pretty enough for showcase but I had commented as much as possible. I hope you enjoy this blog post and give this code-generated report routine a try!

To leave a comment for the author, please follow the link and comment on their blog: Blend it like a Bayesian!. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)