4 Week4: R Markdown

4.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 ```

4.3 RStudio Projects

4.4 Publish your R markdown Documents

Cormen, Thomas H, Charles E Leiserson, Ronald L Rivest, and Clifford Stein. 2009. Introduction to Algorithms. MIT press.

Wickham, Hadley. 2016. Ggplot2: Elegant Graphics for Data Analysis. springer.

Wickham, H., and G. Grolemund. 2016. R for Data Science: Import, Tidy, Transform, Visualize, and Model Data. O’Reilly Media. https://books.google.co.kr/books?id=vfi3DQAAQBAJ.