Choose RMarkdown + Distill for writing a Tech Blog

RMarkdown and Distill are powerful tools for scientific communication.

Jeffrey C. Wong
12-25-2020

RMarkdown is a Champion for Scientific Communication

RMarkdown has had a long history in scientific communication. Using RMarkdown, you can create beautifully rendered technical documents that can be hosted online or sent as pdfs. The documents weave together the output from code, latex, as well as other web tools like html, css, and javascript. By putting data analysis code right next to text, the author can describe and discuss individual steps in analysis, and show how to reproduce it using software. RMarkdown allows authors to construct an entire scientific narrative with the spirit of the scientific method. It facilitates this approach to scientific communication by creating great development flow between code and discussion: the code you write for development is the same code that you share to others to let them read and follow along.

Here are examples of how RMarkdown embeds essential parts of scientific communication into one environment. First, we can write latex.

\[ \int_0^1 x dx = \frac{1}{2}.\]

Next, we can illustrate source code for functions

foo = function(x, y) {
  (x-y)^2 %>% sum() %>% sqrt()
}

Finally, we can execute code inline, and can also generate visualizations.

a = 5
b = a^2
print(b)
[1] 25

Distill is a Better Publishing Platform for Research

Distill is both a publishing framework and machine learning research journal. It is advancing scientific communication by breaking the barriers of traditional pdf documents. Distill articles are html pages that allow publishing new kinds of scientific narratives, including those that have interactive visualizations, videos, and demos. It also follows scientific writing, listing the authors, date published, references, footnotes, and an appendix.

Developers at RStudio have integrated Distill articles into RMarkdown with the #rstats Distill package. RMarkdown users can create Distill articles that can be submitted to the research journal. In addition, they’ve made it easy to collate Distill html articles into an online blog. This further enhances scientific communication because your development environment can also be used for online publishing and content management, creating a single end-to-end environment for development, sharing, and publishing. The Distill package creates the listing page that indexes all blog posts, adds a search bar to the blog, and adds comments and share links to each blog post. You can also link to the underlying RMarkdown source code to show how the blog post was generated. In this way, the blog post turns into a technical document that embodies RMarkdown’s reproducible research features.

A Simple End-to-End Tech Stack

A full Distill blog can be hosted using as few as two components, that are completely free. Publishing can be done without maintaining a server or a database.

  1. RMarkdown, and Distill to build the blog. When the blog is built, a series of .html files are generated that can be uploaded to a webhost.
  2. github pages can host the blog online for free.

Citation

For attribution, please cite this work as

Wong (2020, Dec. 25). Jeffrey C. Wong: Choose RMarkdown + Distill for writing a Tech Blog. Retrieved from http://jeffreycwong.com/posts/2020-12-25-choose-distill-for-writing-a-tech-blog/

BibTeX citation

@misc{wong2020choose,
  author = {Wong, Jeffrey C.},
  title = {Jeffrey C. Wong: Choose RMarkdown + Distill for writing a Tech Blog},
  url = {http://jeffreycwong.com/posts/2020-12-25-choose-distill-for-writing-a-tech-blog/},
  year = {2020}
}