Chapter 3 R markdown
3.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
- 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 includes narration formatted with markdown
- Code chunks
- Code chunks include R Codes
- Code chunks are surrounded by ```
- YAML header
3.2 Wonderful resources for R markdown
3.3 RStudio Projects
- RStudio Projects allows us
- to keep all files relevant to a project together
- to get back to where we left
- Ch8. Workflow: projects in R for data science
3.4 Publish your R markdown Documents
- You can easily publish your R markdown documents
3.5 Quiz 3
I uploaded the lecture video that I recorded for the previous semester. This semester, I am heavily updating the lecture notes of other topics. So I have been recording my lecture video again this semester according to my new lecture notes. However, I don’t have much things to update on the Rmarkdown part and so I just use the same lecture notes and lecture video.
The quiz 3 that you have to do in this week is different from HW2 in my previous lecture. So please ignore the HW2 in the lecture video.
The goal of this Quiz 3 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 important learning objective. I’m thinking to ask you to submit your final project in the form of this bookdown. 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 using the Google Form below.
When you edit your Rmarkdown, cheat sheet would be very useful. So, please visit here and download the cheat sheet for the Rmarkdown. In the cheat, there’s “Write with Markdown” section on the right side of the first page. That section shows the 1-1 correspondence between Rmarkdown and output. Check how each of the Rmarkdown syntax is converted into the output.
For Quiz 3, do the following:
- Following the instructions in the lecture video, create an a template bookdown and publish it on your own bookdown account.
- Replicate the
1.1 Welcome to the Course!and
1.2 Types of Data Analysisin our lecture notes with all text format (e.g., Bold fonts), hyperlink, image (I will upload the image file in the cyber campus), and tables. However, you don’t need to replicate the Datacamp code chunk in
- Include your name at the top of the first page.
- (Very important) You should set your sharing settings as “Anyone - no login required” for TA to assess your bookdown for grading.
- Once you finish to publish your bookdown, please submit your name, student ID number, and bookdown URL using the following Google Form by Sep 26 23:59: https://forms.gle/GLER4EXf4HKXbv6C7.