0
0
R Programmingprogramming~5 mins

Code chunks and output in R Programming - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
A```{r}
B~~~{r}
C<code>
D//{r}
What happens if you set `echo=FALSE` in a code chunk?
ACode runs twice
BCode and output are both hidden
CCode is shown but output is hidden
DCode is hidden but output is shown
Which chunk option stops the code from running?
Aeval=FALSE
Becho=FALSE
Cresults='hide'
Dinclude=FALSE
How do you hide both code and output in a chunk?
Aecho=TRUE only
Becho=FALSE and results='hide'
Ceval=FALSE only
DNo option needed
What is the default behavior of code chunks in R Markdown?
AShow output only
BHide code and output
CShow code and output
DShow code only
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.