First Post!


This is the first post for my R + knitr + jekyll + poole powered blog.

print("Hello, world!")
ā€‹[1] "Hello, world!"

Expect to see some more substantial content in the future!

How It Works

I, like most other programmers, am incredibly lazy, and needed a way to author a blog that was:

  1. Stupidly easy to write for, and
  2. Stupidly easy to deploy.

Iā€™m using a combination of jekyll, which is used to generate the site itself; poole with the theme Lanyon to get a jump start with Jekyll (alongside some very nice, responsive CSS), and a simple make.R script that converts .Rmd posts into .md that can be served on GitHub pages, which is driven mainly through the knitr package.

The R script that powers this website is fairly simple ā€“ we call knitr::knit(), with some knitr hooks + templating set up to support the Jekyll-style markdown output. Check it out here!

Finally, I have a simple Makefile simply calls R --vanilla --slave -f make.R to make the site. So, when I want to write a new article, I can just:

  1. Create a file <date>-<title> in post/,
  2. Write something that may or may not be incredibly exciting to read,
  3. Call make to update the site.

In fact, for 1., because (as I said before) I am a very lazy programmer, so I also have a local .Rprofile for this project that gives me some simple functions. In particular, I have a function create_post() for creating a new post with some title, and the current date automatically pre-pended to the post name.

Then GitHub Pages takes care of calling Jekyll to produce the actual site to be served. Neat!

The icing on the cake ā€“ by giving the project an (empty) DESCRIPTION file, and telling RStudio that this is a Makefile-managed project, I can also rebuild the site right from RStudio with Cmd + Shift + B.


Comments