0
0
R Programmingprogramming~20 mins

R Markdown document creation in R Programming - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
R Markdown Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2: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
```
AError: object 'x' not found
Bx * 2
C5
D10
Attempts:
2 left
💡 Hint
The chunk runs R code and shows the result of the last expression.
🧠 Conceptual
intermediate
2: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?
ATo write R code that runs before the document
BTo specify document metadata and output format
CTo add comments inside the document
DTo create tables and figures automatically
Attempts:
2 left
💡 Hint
YAML header is enclosed by --- lines and sets options for the whole document.
🔧 Debug
advanced
2: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')))
```
AError: arguments imply differing number of rows: 3, 2
BNo error, outputs summary of data frame
CError: object 'data' not found
DError: unexpected symbol in 'summary(data.frame(a = 1:3, b = c('
Attempts:
2 left
💡 Hint
Check if the vectors used to create the data frame have the same length.
📝 Syntax
advanced
2: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?
A{{n}}
B${n}$
C`r n`
D<%= n %>
Attempts:
2 left
💡 Hint
Inline R code is enclosed in backticks with r before the expression.
🚀 Application
expert
2: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?
AOne HTML file and one folder with supporting files
BOne HTML file named report.html
COnly the original Rmd file is updated
DMultiple HTML files, one per code chunk
Attempts:
2 left
💡 Hint
Consider how images and dependencies are stored when knitting to HTML.