R Markdown (.Rmd) mixes prose, code chunks, and outputs—knitr executes chunks and renders HTML/PDF/Word. Install rmarkdown locally; playground prints chunk concepts.
Chunk anatomy
```{r setup, message=FALSE}
df <- data.frame(x = 1:3, y = c(2, 4, 6))
summary(df)
```
Reproducibility
Reports re-run from source—pair with Git and renv for pinned packages. Compare notebook workflows with Jupyter in Python.
Important interview questions and answers
- Q: What does knitr do?
A: Executes R chunks and embeds output in the rendered document. - Q: Rmd vs script?
A: Rmd is narrative + analysis; scripts are batch automation—often both in one repo.
Self-check
- What file extension for R Markdown?
- Why pin package versions in reports?
Tip: Commit .Rmd + renv.lock, not knitted HTML, unless your team policy says otherwise.
Interview prep
- What is an Rmd chunk?
Fenced code region executed by knitr during render.