This repository is a skeleton for a reproducible R pipeline that allows you to create and publish analyses online hosted through Github Pages. It works by knitting the Rmd files in the notebooks
directory into the export
directory to create a static HTML site which can be hosted from the repository containing the original work. This is nice because it reduces the number of repositories related to a single project and allows you to keep all of your work in one place.
To use this pipeline, there are a few simple steps.
utils
directory.notebooks
directory. Make sure your filenames follow the naming scheme. Make sure each notebook includes the JavaScript to generate the menus.utils/export.R
. This will generate the necessary JavaScript files for the page menus and knit each Rmd file in the notebooks
directory. All output HTML files should appear in the export
directory.Files in the notebooks
directory need to follow a particular naming scheme so that the R scripts which knit the notebooks order them correctly in the menu. This scheme begins each file with a 2-digit number indicating the order (first is 01
, second 02
, etc.). Each word in the notebook title (what you want displayed in the menu) should follow that number with hyphens in place of spaces.
For example, if the fifth notebook was titled “Principal Component Analysis with Scree Plot”, then the filename would be 05-principal-component-analysis-with-scree-plot.Rmd
. The utilities function will automatically capitalize all words in the title.
The homepage for your project will also be located in this folder but it will be named index.Rmd
(not following the naming scheme). This is important because Github pages requires an index.html
file in the root directory for the project as the homepage.
A sample structure, from the Github repo for this project, is given below.
| notebooks
| 01-sample-page.Rmd
| index.Rmd
These are some things I’ve noticed that make the output look nicer when using this workflow.