The bookdown package makes it easy to create books with R Markdown and RStudio. These can be easily published online and in various formats: HTML, PDF, ePub, and Kindle. Read about bookdown and see hundreds of online books written with it at bookdown.org.

Once you are ready to write your own book, read the online documentation.

Examples:

Download the template

Download a zip file of the bookdown-demo repository. You can use the ‘download zip file’ button on the GitHub repository or you can navigate to your ‘RWorkflow’ folder in RStudio and click ‘More’ in the Files panel and select ‘Set as working directory’. Then issue these commands.

library(RWorkflowsetup)
download.repo("bookdown-demo")

INCOIS participants: You will find a copy of the repository in the RWorkflow directory that you copied from the thumb drive.

This is a copy of the original bookdown-demo by Yihui Xie, the creator of the bookdown package, with a few changes so it works immediately with GitHub.

Build the book

  1. Open RStudio
  2. Click the project button in top right and select ‘New Project’.
  3. Click ‘Existing Directory’ and choose your ‘bookdown-demo’ folder.
  4. Click the Build tab and click ‘Build book’

Your book should appear.

Post and online version of your book via GitHub

You can host your book many places. To do so on GitHub, do the following.

  1. Make your bookdown-demo folder into a repository.
  • Open GitHub Desktop, click ‘File > New Repository’
  • Type bookdown-demo as the name and <yourbasedir>\RWorkflow as the local path. This assumes that the bookdown-demo folder is in the RWorkflow directory. If not, replace the path with the directory where you put the bookdown-demo folder.
  1. Publish the bookdown-demo folder to GitHub. Click the Publish button in GitHub Desktop.
  2. Open the repository on GitHub.
  • Click Settings, and scroll down to GitHub Pages. Change the source to master branch/docs folder and click save.
  1. Your book should appear at https://<yourname>.github.io/bookdown-demo/ in a few minutes.

NWFSC Math Bio Program