Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start an R Markdown document with the correct YAML header.
R Programming
--- title: "My Document" output: [1] ---
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using an output format not supported by R Markdown
Forgetting to put quotes around the title
✗ Incorrect
The output field specifies the format of the R Markdown output. html_document creates an HTML file.
2fill in blank
mediumComplete the code to insert an R code chunk in R Markdown.
R Programming
```[1]
summary(cars)
``` Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using other languages like python or bash inside R Markdown R chunks
Forgetting the triple backticks
✗ Incorrect
R code chunks start with ```r in R Markdown.
3fill in blank
hardFix the error in the YAML header to correctly specify the author.
R Programming
--- title: "Analysis" author: [1] output: html_document ---
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the author name
Including the key name again inside the value
✗ Incorrect
The author name must be a string in quotes in YAML to be valid.
4fill in blank
hardFill both blanks to create a code chunk with echo turned off.
R Programming
```[1] [2] plot(pressure) ```
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong language name
Setting echo to TRUE instead of FALSE
✗ Incorrect
The chunk language is r and echo=FALSE hides the code in the output.
5fill in blank
hardFill all three blanks to create a YAML header with title, author, and date.
R Programming
--- title: [1] author: [2] date: [3] output: html_document ---
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the date
Using unquoted strings in YAML
✗ Incorrect
YAML strings should be quoted. The date is also quoted as a string.