Compile R for Data Science to a PDF
R for Data Science by Hadley Wickham and Garrett Grolemund introduces a modern workflow for data science using tidyverse packages from R. The source is available on GitHub and a version compiled for the web is at http://r4ds.had.co.nz/. Even though the HTML format is nice, I still like to have a PDF around. Here’s how to compile it from the source. (Please consider buying a copy to support their work.)
These instructions assume you are using a Debian based OS and have R, LaTeX, and pandoc installed.
- Download the repository from https://github.com/hadley/r4ds
From R, run
From the command line, run
sodu apt install phantomjs
From TeX Live (or whatever TeX manager you use) make sure
sudo env PATH="$PATH" tlmgr --gui
Compile the book using
# PDF bookdown::render_book("index.Rmd", output_format = "bookdown::pdf_book") # Static website bookdown::render_book("index.Rmd", output_format = "bookdown::gitbook")
My resulting PDF is 10.9MB and 412 pages as of 2016-10-31.