Question 1

Who created Markdown?

  • Yihui Xie
  • John Gruber
  • Robert Gentleman
  • Hadley Wickham

Answer

What is Markdown? What is Markdown?

Question 2

When writing a document in R Markdown, how do you denote the beginning of an R code chunk?

  • <rcode>
  • โ€™โ€™โ€™
  • โ€™โ€™โ€™{r}
  • <code>

Question 3

When using knitr, how do you indicate the height and width of a plot created in a code chunk?

  • Set the โ€˜heightโ€™ and โ€˜widthโ€™ options for the code chunk
  • Set the โ€˜sizeโ€™ and โ€˜scaleโ€™ options for the code chunk
  • Set the โ€˜fig.heightโ€™ and โ€˜fig.widthโ€™ options for the code chunk
  • Set the โ€˜dpiโ€™ option for the code chunk

Answer

According to the Yihui Xie on its webpage:

fig.width, fig.height: (both are 7; numeric) Width and height of the plot (in inches), to be used in the graphics device.

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 for a given code chunk?

  • Set the option message = FALSE
  • Set the option highlight = TRUE
  • Set the option results = โ€œasisโ€
  • Set the option tidy = FALSE

Answer

# Example.
cat("**Hello** World!")

Hello World!

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 Markdown file generated by knitr is the appropriate file to edit.
  • Editing the HTML file requires knowledge of a separate markup language.
  • The HTML file is not a text file.

Answer

Processing of knitr Documents (what happens under the hood):

  • You write the RMarkdown document (.Rmd)
  • knitr produces a Markdown document (.md)
  • knitr converts the Markdown document into HTML (by default)
  • .Rmd -> .md -> .html
    • This process will overwrite the .md and .html files.
  • You should NOT edit (or save) the .md or .html documents until you are finished