How I Set Up This Blog

- 1 min

The purpose of this blog is to share my research and R code in order to facilitate reproducibility. Therefore, I have structured this blog to allow me write using the following workflow:

  1. Write my posts as Rmarkdown files (.Rmd) saved in the _drafts/ folder
  2. Knit the file into markdown (.md) using a helper function (rmd2md.R, contained in the _drafts/ folder as well)
  3. Move the resultant .md file to the _posts/ folder where Jekyll (via GitHub) can render it as .html.

The original Jekyll blog repo was forked from Jekyll Now.

I have taken inspiration for this workflow from Andy South, Nicole White and Jason Fisher.

Particular thanks to Jason Fisher for the rmd2md() helper function on which the following script is based.

rmd2md <- function(input, base.url = "/") {
  opts_knit$set(base.url = base.url)
  fig.path <- paste0("figures/", sub(".Rmd$", "", basename(input)), "/")
  opts_chunk$set(fig.path = fig.path)
  opts_chunk$set(fig.cap = "center")
  knit(input, envir = parent.frame())
Danny Wong

Danny Wong

Anaesthetist & Health Services Researcher at the NIAA-HSRC & UCL-DAHR

comments powered by Disqus
rss facebook twitter github youtube mail spotify instagram linkedin google pinterest medium