Skip to content

02 Writing with R Markdown

Neha Moopen edited this page Aug 5, 2021 · 3 revisions

Chapters in the Data Privacy Handbook are written as R Markdown (.Rmd) files.

R Markdown provides an authoring framework where you can easily combine text and code to generate high-quality documents that can be shared with an audience. These documents are fully reproducible and support dozens of static and dynamic output formats such as HTML, PDF, and Word. In our case, we use the HTML output format which can be displayed on the Handbook's website.

Installation

The latest versions of R Studio should have R Markdown pre-installed, but you can install the package manually using the following code:

install.packages("rmarkdown")

Usage

For guidance on how to get started with and use R Markdown effectively, see the documentation.

In short, the workflow is as follows:

  1. First of all, you want to load the rmarkdown package with the following command:

library(rmarkdown)

  1. Edit your .Rmd file

  2. Click the Knit button in RStudio to render the file and preview the output.

Markdown

Markdown is a markup language to format text. You can check out the following links to familiarize yourself with the formatting, it's pretty straightforward!

References

  1. R Markdown from RStudio