Challenge - 5 Problems
R Markdown Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of a simple R Markdown chunk
What will be the output shown in the knitted document for this R Markdown chunk?
R Programming
```{r} x <- 5 x * 2 ```
Attempts:
2 left
💡 Hint
The chunk runs R code and shows the result of the last expression.
✗ Incorrect
The variable x is assigned 5, then multiplied by 2. The output is the value 10.
🧠 Conceptual
intermediate2:00remaining
Purpose of YAML header in R Markdown
What is the main purpose of the YAML header at the top of an R Markdown document?
Attempts:
2 left
💡 Hint
YAML header is enclosed by --- lines and sets options for the whole document.
✗ Incorrect
The YAML header defines metadata like title, author, date, and output format such as HTML or PDF.
🔧 Debug
advanced2:00remaining
Identify the error in this R Markdown chunk
What error will this R Markdown chunk produce when knitted?
R Programming
```{r} summary(data.frame(a = 1:3, b = c('x', 'y'))) ```
Attempts:
2 left
💡 Hint
Check if the vectors used to create the data frame have the same length.
✗ Incorrect
The vector 'a' has length 3 but 'b' has length 2, so data.frame() fails with a row number mismatch error.
📝 Syntax
advanced2:00remaining
Correct syntax for including inline R code in R Markdown
Which option shows the correct way to include inline R code that prints the value of variable
n in R Markdown text?Attempts:
2 left
💡 Hint
Inline R code is enclosed in backticks with r before the expression.
✗ Incorrect
Inline R code uses backticks and the letter r like `r expression` to evaluate and insert the result.
🚀 Application
expert2:00remaining
Number of output files generated by knitting an R Markdown document to HTML
If you knit an R Markdown document named
report.Rmd to HTML, how many files are typically created in the output folder?Attempts:
2 left
💡 Hint
Consider how images and dependencies are stored when knitting to HTML.
✗ Incorrect
Knitting to HTML usually creates one HTML file plus a folder with images, CSS, and JavaScript needed for the document.