Jump to ratings and reviews
Rate this book

The R Series

Dynamic Documents with R and knitr

Rate this book
Quickly and Easily Write Dynamic Documents Suitable for both beginners and advanced users, Dynamic Documents with R and knitr, Second Edition makes writing statistical reports easier by integrating computing directly with reporting. Reports range from homework, projects, exams, books, blogs, and web pages to virtually any documents related to statistical graphics, computing, and data analysis. The book covers basic applications for beginners while guiding power users in understanding the extensibility of the knitr package. New to the Second Edition Boost Your Productivity in Statistical Report Writing and Make Your Scientific Computing with R Reproducible Like its highly praised predecessor, this edition shows you how to improve your efficiency in writing reports. The book takes you from program output to publication-quality reports, helping you fine-tune every aspect of your report.

294 pages, Paperback

First published July 15, 2013

5 people are currently reading
50 people want to read

About the author

Yihui Xie

12 books15 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
16 (34%)
4 stars
18 (39%)
3 stars
12 (26%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 6 of 6 reviews
Profile Image for Jerzy.
555 reviews133 followers
July 20, 2016
One of my favorite acknowledgements sections ever:
"First, I want to thank my wireless router, which was broken when I started writing the core chapters of this book (in the boring winter of Ames). Besides, I also thank my wife for not giving me the Ethernet cable during that period."

Xie (who also created the knitr package) writes clearly and with tongue-in-cheek humor. The book is well worth reading to get a solid overview of knitr's potential.
Yes, there is plenty of good material about knitr online already. But as Xie has said (though I can't find the quote so paraphrasing here), he's read, answered, & summarized thousands of common blog-post comments and Stackoverflow questions about knitr, so you don't have to.
Xie also has some broader discussions about the benefits of reproducible research, and a list of similar tools for other languages (e.g. Python), in case it helps you convince your colleagues to get on this bandwagon.

Xie wrote his own book in knitr. He also mentions a textbook on The Analysis Of Data written in knitr and available freely online.
Profile Image for Eric.
5 reviews2 followers
October 4, 2014
This is a book from the author of knitr, the R package for reproducible research. If you don't know how to write R markdown or just want to master the knitr, this is definitely the best book to begin with.
Profile Image for Huong.
158 reviews4 followers
June 25, 2018
What is better than the R package author explaining it.
Profile Image for Matija.
93 reviews24 followers
June 30, 2016
A general purpose software developer, I succumbed to the recent data science craze and started learning R. Along the way I found out about knitr, and learned about how its predecessor, Sweave was both demanding in terms of LaTeX knowledge and limiting in functionality. Knitr's ability to work with a dialect of markdown instead of LaTeX and ease of use on which the community seemed to agree sounded appealing, so I decided to test it out. I took my learning to work and wrote a report generator for a customer by parsing some CSV and XML files (R has plenty of packages for that), and producing decent looking PDFs with some tables and graphs based on combined inputs. The power and speed with which knitr can be used in synergy with the already abundant treasure chest of R took me by a pleasant surprise, and I realized it is a very worthy addition to any developer's toolkit even outside of the data science domain. Still, I had the feeling I was using it in a hacky kind of way, and error reporting by the knitr engine (as with R in general, it seems) leaves a lot to be desired, so I decided to learn more. And how better than directly from the author of the very package in question?

The book is itself written using knitr, which is a nice touch. It starts off in a usual way, providing some motivation for R, knitr, reproducible research, etc. A few minimal examples are then shown, followed by a quick rundown of the most popular editors which can be used to effectively work with knitr source files. So far so good, but at this point I was expecting to start gaining some knowledge from ground up - e.g. a definition of key terms, a high-level overview of the knitr engine workflow, first steps in producing a report, or some other usual introductory topic. Alas, the author instead jumps straight into the nitty-gritty of how parsing is performed, literally showing a regular expression which parses code chunk options on the first page of the section called "Document formats". Now I'm fine about seeing a regex, and it did give me a clue into the workings of the system, but this is a symptom of a deeper problem that I have with the book: the author delves into subjects that he is enthusiastic about, and not necessarily those which would help a novice user ease into using the package. Sure enough, what follows is what seems to me to be a happenstance mix of information, some useful, some interesting, some technical and some very dense (YMMV). R and research lingo is liberally used throughout, and, to my surprise, lots of LaTeX too! If something needs to be explained, a LaTeX equivalent is used for demonstration. If some option does something interesting, the LaTeX output it produces is given for the reader as evidence. While learning LaTeX would be infinitely interesting and undoubtedly useful (as would a thousand other things), a developer nowadays needs to split his time between a lot of new technologies (and a good number of legacy ones), and the big part of the original appeal of knitr as advertised is its ability to generate functional reports without any knowledge of LaTeX - so why use it so extensively throughout the book!?

"Dynamic Reports with R and knitr" certainly has a few things to offer to an interested novice user without prior experience in writing papers and academic research. If I had a sense of R's and knitr's power before reading the book, that sense has only intensified after finishing it. The hacky feeling however has unfortunately also intensified, and I learned I actually wasn't doing anything wrong - R is a quirky tool (yes, I'm a programming language aficionado), and knitr simply follows suite. Programming entities are given short and cryptic names, the room for errors is huge with shared namespaces and a powerful yet Rube-Goldberg kind of execution model built from numerable disparate components (the blessing and curse of open source), etc. No practical guide in terms of bug fixing or debugging is given anywhere in the book, yet this is one of my biggest hurdles in effectively using knitr. It is an incredibly powerful and rapid tool, so I intend to continue using it and exploring its power and its quirkiness - I just wish this book gave more practical advice to help along the way.

Roughly half of the text is devoted to what I can translate into practical knowledge about how to actually utilize knitr, and then some percentage of that is addressed to potential contributors (as knitr is open source) rather than users. What I originally hoped to get from this book based on its title - a practical guide for a novice user on how to leverage the power of R and knitr in general tasks - takes up about the same amount of space as could be covered by five or six medium-length to long blog posts. I'm happy with what I've learned, but I also feel I missed a lot of content due to impenetrable terminology and lack of prior knowledge of LaTeX. I feel like an experienced R user or someone in an academic setting who would be using knitr on one-off basis would benefit more from this book than a software dev looking for practical advice in writing maintainable and debugable components which can potentially become parts of larger automated workflows (as did my knitr report for the customer, after a lot of Googling for quirky error messages). On the brighter side, I was pleasantly surprised with a few unexpected gems which were given a passing mention, like the ability to create entire websites, slideshows and interactive documents with knitr, or a way to have live output of knitr in RStudio as the report is being written. At moments I quite enjoyed it and at others just found myself glancing over page after page. I will probably be coming back to it if I get to use knitr more in hopes of it opening some more doors to me as I get to learn about this fascinating and burgeoning field.
Profile Image for Liz.
431 reviews15 followers
July 27, 2017
Hard to read, but lots of good information for making awesome documents using R!
Profile Image for Chip.
19 reviews
February 20, 2016
I use to spend hours crafting reports; now it takes minutes. With Rstudio and knitr I get consistent, reproducible reports at the click of a button.

The ideas presented in this book are fantastic. If you have used knitr in the past, you could breeze through this book in one day.

There are some specific ideas that I needed, like custom CSS or building custom themes that this books covers. I skipped the LATEX sections which aren't applicable to me right now.
Displaying 1 - 6 of 6 reviews

Can't find what you're looking for?

Get help and learn more about the design.