Agenda


  • what is Markdown?
  • what is RMarkdown?
  • how is RMarkdown different from Markdown
  • install TinyTex
  • explore RMarkdown syntax
  • explore and learn to create
    • documents
    • presentations
    • websites
    • books
    • blogs

Markdown


  • Markdown is a text to HTML conversion tool
  • created by John Gruber
  • is written in Perl
  • is free software
  • and you can try it online using Dingus

RMarkdown


RMarkdown combines the core syntax of Markdown with embedded R code chunks to create dynamic documents. It enables easy creation of dynamic documents, reports and presentations which are fully reproducible.

With RMarkdown, we can combine R codes, plots and text to create beautiful reports and presentations. The reports can be generated in different formats such as:

  • PDF
  • HTML
  • MS Word

The best part about RMarkdown is when you have to make some changes to your code or the underlying data and recreate the entire document. You can make the necessary changes and RMarkdown will recreate the document with just a single click of a button.

Libraries


Install and load the rmarkdown package.

# install
library(rmarkdown)

Tinytex


In order to generate PDF documents/presentations, you will need LaTex. If you have not heard of or installed LaTex, you can instead use TinyTex.

install.packages("tinytex")
tinytex::install_tinytex()

RMarkdown Syntax


  • headers
  • emphasis
  • lists
  • links
  • images
  • code chunks

Headers



Emphasis



Unordered Lists



Ordered Lists



Images



Code Chunks


It is when creating reports that contain R code, plots and other outputs that we will appreciate RMarkdown the most. It saves us from the cut/copy/paste ritual while saving time and minimising errors.

Whenever the code or data changes, RMarkdown will automatically regenerate the whole document with the updated results and therein lies its magic.


Options



Languages


  • R
  • Python
  • SQL
  • Bash
  • Rcpp
  • C & Fortran
  • Javascript & CSS
  • Julia

Documents


Presentations


Websites


References