-
Notifications
You must be signed in to change notification settings - Fork 7
02 Writing with R Markdown
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.
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")
For guidance on how to get started with and use R Markdown effectively, see the documentation.
In short, the workflow is as follows:
- First of all, you want to load the
rmarkdown
package with the following command:
library(rmarkdown)
-
Edit your .Rmd file
-
Click the Knit button in RStudio to render the file and preview the output.
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!
- The R Markdown cheatsheet
- GitHub's Mastering Markdown Guide.