Chapter 2 R markdown (Week 2)

2.1 What is R markdown documents?

  • An R markdown document (a file with the extension .Rmd) allows us to create a report in a variety of formats (e.g., html, pdf, word, slides, interactive documents) that includes your codes, results, and texts.

  • An R markdown document is a plain text file with special formatting characters (i.e., Pandoc’s Markdown).

  • When you render an R markdown document using the render() function,

    • knitr executes all code chunks in an R markdown document to create a new markdown document (a file with the extension .md), and
    • pandoc (a universal document converter) converts a markdown document to the final format.

Rendering R markdown Document

  • An R markdown document has the following structure:
    • YAML header
      • YAML includes options for rendering
      • YAML is surrounded by - - -
      • YAML stands for “YAML Ain’t Markup Language”
    • Text
      • Text includes narration formatted with markdown
    • Code chunks
      • Code chunks include R Codes
      • Code chunks are surrounded by ```

2.3 RStudio Projects

2.4 Publish your R markdown Documents

2.5 Homework 2

  • The goal of this HW2 is to check whether you can publish your contents using bookdown. In this way, you can communicate your findings with others. Please note that the ability to communicate with others is one of our learning objective. So create a bookdown on the bookdown.org following the instructions in the lecture video and below, and send the URL (or link) of your published bookdown to by the 11:59pm on Mar 17 (Next Wed) with the email title “[HW2] your name here”.

  • For HW2, do the following:

    1. Following the instructions in the lecture video, create an a template bookdown and publish it on your own bookdown account.
    2. Include the Code chunk 1, 2, 3, and 4 for HW1 in the first page of your bookdown website.
    3. Include your name at the top of the first page.
    4. Send the link to your bookdown website to to by the 11:59pm on Mar 17 (Next Wed) with the email title “[HW2] your name here”. (e.g., [HW2] Sunbok Lee)