Week 2 Quiz:Reproducible Research(Data Science Specialization):Answers2025
Question 1
Who created Markdown?
✅ John Gruber
❌ Yihui Xie
❌ Robert Gentleman
❌ Hadley Wickham
Explanation:
Markdown was created by John Gruber in 2004 with help from Aaron Swartz. It’s a lightweight markup language for formatting text easily.
Question 2
When writing a document in R Markdown, how do you denote the beginning of an R code chunk?
✅ ```{r}
❌ ```
❌ <rcode>
❌ <code>
Explanation:
In R Markdown, an R code chunk begins with
```{r}
and ends with
This syntax tells knitr to execute the R code within the chunk.
Question 3
When using knitr, how do you indicate the height and width of a plot created in a code chunk?
✅ Set the ‘fig.height’ and ‘fig.width’ options for the code chunk
❌ Set ‘height’ and ‘width’
❌ Set ‘size’ and ‘scale’
❌ Set ‘dpi’
Explanation:
You can control figure size in a chunk like this:
```{r, fig.height=5, fig.width=7}
These options define plot dimensions in inches.
Question 4
With some code chunks, we may not want the output generated by the chunk to be rendered into HTML but would prefer to print the output verbatim. How can we specify this preference?
✅ Set the option results = "asis"
❌ tidy = FALSE
❌ highlight = TRUE
❌ message = FALSE
Explanation:results = "asis" tells knitr to treat output as raw Markdown or HTML—displayed as-is instead of being formatted as code output.
Question 5
When using knitr and R Markdown and producing output in HTML, why should you never edit the resulting HTML file?
✅ Every time you knit() the R Markdown file, the HTML file will be overwritten
❌ The HTML file is not a text file
❌ Editing HTML requires extra knowledge
❌ The Markdown file is more appropriate to edit
Explanation:
When you knit() again, the HTML file is regenerated from the .Rmd file, so any manual changes in the HTML will be lost.
🧾 Summary Table
| Q# | ✅ Correct Answer | Key Concept |
|---|---|---|
| 1 | John Gruber | Creator of Markdown |
| 2 | “`{r} | Code chunk syntax in R Markdown |
| 3 | fig.height & fig.width | Setting plot dimensions |
| 4 | results = “asis” | Output printed verbatim |
| 5 | HTML is overwritten on knit | Edit only the .Rmd file |