Recall & Review
beginner
What is a code chunk in R Markdown?
A code chunk is a section in R Markdown where you write R code that will be run when the document is knitted. It starts with ```{r} and ends with ```.
Click to reveal answer
beginner
How do you show the output of a code chunk in the knitted document?
By default, the output of the code inside a chunk is shown below the code when you knit the document.
Click to reveal answer
beginner
What does the chunk option `echo=FALSE` do?
It hides the R code in the output but still shows the results of running the code.
Click to reveal answer
intermediate
How can you prevent both code and output from showing in the final document?
Use chunk options `echo=FALSE` and `results='hide'` together to hide both code and output.
Click to reveal answer
intermediate
What is the purpose of the chunk option `eval=FALSE`?
It prevents the code inside the chunk from running, so no output or results are generated.
Click to reveal answer
In R Markdown, which symbol starts a code chunk?
✗ Incorrect
Code chunks in R Markdown start with three backticks followed by {r}.
What happens if you set `echo=FALSE` in a code chunk?
✗ Incorrect
Setting echo=FALSE hides the code but still shows the output.
Which chunk option stops the code from running?
✗ Incorrect
eval=FALSE prevents the code from running, so no output is produced.
How do you hide both code and output in a chunk?
✗ Incorrect
Using echo=FALSE hides code and results='hide' hides output.
What is the default behavior of code chunks in R Markdown?
✗ Incorrect
By default, both code and output are shown in the knitted document.
Explain what a code chunk is and how its output appears in an R Markdown document.
Think about how you write and run R code inside a document.
You got /3 concepts.
Describe how to control the visibility of code and output using chunk options.
Chunk options let you decide what the reader sees.
You got /3 concepts.