I’m now using a properly modular Rmarkdown workbook, and really quite chuffed with it! I’ve seen discussion of electronic lab notebooks for bioinformatics with only mention of org-mode for emacs users, IPython (now the Jupyter project) and the likes of Evernote/Word etc., so I’m sharing the basic workings of mine.
Here’s its custom knit function, of the kind I wrote about the other day:
The workflow :
When the knit button is clicked (or
K), the document renders itself to markdown, and the notes specified as ‘children’ (in the chunk at the bottom of the top picture) are stuck onto the end. These individual notes are written from Rmarkdown themselves with YAML headers:
This header just specifies to knit quietly (i.e. not preview the resulting markdown) and pass on an instruction to pandoc to use Atx-style headers (the ones with
#symbols, needed for proper table of contents numbering down the line). The R code that follows it prints the title as this sort of [second-level] header.
…during that knitting process the big code chunk in the top picture writes a new header configuration file
Workbook-header.yaml(essential for a proper table of contents)
sinkallows this header to be concatenated with the compiled workbook,
- Lastly the HTML workbook is written and previewed, and the temporary (header-less) compilation file is removed with
unlink. I chose to keep the full compiled
Workbook-compiled.Rmdfile for the time being.
Custom CSS styling for the Table of Contents is below and here, along with all the other code snippets in this post.