29 Feb 2020


This website uses R Markdown documents created in RStudio and ultimately sent to the internet. This workflow requires some additional setup, but in the current build of the website files may be built and previewed locally, then pushed to the GitHub repository which hosts the site.

There are several dependencies to this process. The website is created and hosted via GitHub Pages and as such is built using Jekyll. The support for R Markdown is done using RStudio, and formatting corrections are done using the additional resources of prettydoc to add styling to the knitting process and the related project prettyjekyll to properly build the pages for the website.

From Creation to Publication

Creating & formatting the file

Individual posts are created as R Markdown files. If desired, a draft of the page’s contents may first be made in the _drafts directory. Its contents will not show up on the website (publically or in the local preview,) but it may be knitted in the usual fashion of R Studio to be previewed. Note that its formats will not be perfect, but the formatting will be fixed later. Then, the file should be moved or copied to the _knitr directory.

Once the file is ready to be previewed locally, run the following command in the RStudio console:


This command will correctly format the post and create a file markdown under the _posts directory. Note that this command essentially acts as a replacement for the knitting process. Note also that choose.files() may be replaced with the file directory; this command simply opens up a UI to select the file from the computer.

Note that as currently configured, these posts will show up on the blog by default. They may of course be moved if they are desired to be elsewhere on the site, but the navigation bar does not update automatically so it should be manually changed. One of the features of the website as currently built is that it uses Liquid to implement some programmatic options in .html or markdown documents. (Liquid code is how posts are automatically listed.)

Previewing locally & publishing

The site may be emulated using a Ruby command in the OS’ standard command line directory. First, navigate to the local directory of the GitHub project using the cd command; by default when downloading from a GitHub repository, this will go to one’s documents folder. Then run the following command:

bundle exec jekyll serve 

Doing so will run a local version of the website for preview that by default may be found on This preview is updated live with changes, so there will show up as soon as the post is formatted (even if changes have not yet been comitted.)

Once the post appears correctly, commit all changes. Through git– either in the RStudio UI or another git program– be sure to pull, check for any conflicts, and then push the changes to the GitHub repository. Changes will go live when they are commited to the master branch.

Additional Comments


I first learned of RStudio from a presentation given by Boyan Kostadinov at UCR on November 8, 2019. I have attached a link to a page with some of his publications; in particular, I recommend looking at the document “Creating Dynamic Mathematical Documents in RStudio by Unifying Computing with R and Typesetting with LaTeX” to learn more about RStudio.

RStudio itself runs a version of markdown called Pandoc, which among other things has great support for \(\LaTeX\). Additionally, out of the box R Markdown documents can include content programmed with the R programming language. Other languages, such as Python, can also be implemented if so desired.

The website for RStudio and its discussion of R markdown may be found http://rmarkdown.rstudio.com.

Other tips

MathJax is needed to properly display \(\LaTeX\), so be sure the default post layout includes an appropriate script.