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
- A new chapter that introduces R Markdown v2
- Changes that reflect improvements in the knitr package
- New sections on generating tables, defining custom printing methods for objects in code chunks, the C/Fortran engines, the Stan engine, running engines in a persistent session, and starting a local server to serve dynamic documents
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.
Table of Contents
Good and Bad Practices
A First Look
Extracting R Code
Plot Size in Output
Extra Output Options
The tikz Device
When to Update Cache
Load Cache Manually
Languages and Tools
Tricks and Solutions
Pandoc’s Markdown Extensions
Interactive Documents with Shiny
Extending R Markdown v2
Changes in R Markdown from v1 to v2
Serve Dynamic Documents
Web Site and Blogging
Literate Programming for R Packages
Other R Packages
Yihui Xie is a software engineer at RStudio. He earned a PhD from the Department of Statistics at Iowa State University. His research focuses on interactive statistical graphics and statistical computing. He is an active R user and the author of several award-winning R packages, such as animation, formatR, Rd2roxygen, and knitr. He is also the founder of "Capital of Statistics," a large online statistics community in China.
Featured Author Profiles
"… a gold mine of ideas: things I had no idea knitr could do (integrate with different languages like Python), and tricks to get around some of the awkward things I needed to do (moving all the code to an appendix for tech-fearful readers). It also explains all the guts of the system and is especially informative about how knitr can cache results of time-intensive calculations, so that they do not have to be rerun each time you compile the document if the precedents have not changed. The book is well written …"
—MAA Reviews, December 2015
Praise for the First Edition:
"After reading Dynamic Documents with R and knitr, … I became a fan of this package and its flexibility. The book is written in a conversational style that gives a clear and practical introduction to knitr for both beginners and advanced users. … Compared with Sweave, knitr is more powerful. … Furthermore, knitr is more flexible than Sweave. … Most impressively, caching can be incorporated in a simple way by knitr. … The book is readable with a clear overall structure. … this book allows us to enhance our knowledge of knitr’s usage and quickly find what we want."
—The American Statistician, February 2015
"The book provides a systematic description of the package [knitr], including its concepts, design principles, and philosophy. It also has many examples, well-thought-out advice, and useful tips and tricks. … The book is well written. It has introductory material useful for novices as well as advice for more seasoned users, all explained in conversational English without unnecessary technical jargon. … While I have been using Sweave and then knitr for several years, I still learned many new useful things from the book. … the book deserves a place on the bookshelves of both new and experienced R and TeX users."
—Boris Veytsman, TUGboat, Volume 35, 2014
"If you are looking to learn how to use knitr, this book is for you. There are a limited number of resources for learning knitr because the package is relatively new and the documentation produced by Xie is so good. … I think this book will continue to be the best resource about knitr …easy to understand … this is a great read and handy desk reference for the regular knitr user."
—Journal of Statistical Software, January 2014
"Three recent books have significantly influenced how I use R in reproducible work: Dynamic Documents with R and knitr by Yihui Xie, Reproducible Research with R and RStudio by Christopher Gandrud, and Implementing Reproducible Research edited by Victoria Stodden, Friedrich Leisch, and Roger D. Peng … I recommend all three books to R users at any level. There really is something here for everyone."
—Richard Layton, PhD, PE, Rose-Hulman Institute of Technology, Terre Haute, Indiana, USA