What is this?

If you use R Markdown for data analysis projects, you might like to put your HTML reports on the web for people to look at. It would be nice if those pages were closely tied to your GitHub repository, but HTML pages render as code on GitHub proper. So this repository is a template for making a GitHub pages version of your analysis. Not that you have to use GitHub pages: you could just as easily rsync your HTML files anywhere else that you want.

For example, here is the table of contents for rendered versions of every R Markdown document in this repository.

Table of contents

What does this do?

As little as possible. The aim is to be very lightweight. But it does do this:

  1. Includes an index page (you’re looking at it) with a table of contents for every .Rmd file in the root directory of your project.
  2. Inserts a navigation header into each rendered HTML file.
  3. Sets some shared options for HTML documents rendered from R Markdown.
  4. Contains a basic Makefile to render all the documents.

If you want to get fancy, you can add these two lines to the [remote "origin"] section of your .git/config file, so that any git push command will push to both the master and the gh-pages branch. Or you can just rename master to gh-pages. (This tip from Brett Terpstra, who gives more details.)

push = +refs/heads/master:refs/heads/gh-pages
push = +refs/heads/master:refs/heads/master

Don’t forget to commit the HTML files that you generate.

See the GitHub repository for the source. See the R Markdown documentation if you want to do more.