Reproducible analysis means others can rerun your code and get the same results—set.seed(), renv, Git, and R Markdown knit to HTML/PDF.
Practices
- Version control .R and .Rmd files
- renv or renv.lock for package snapshots
- Document data pulls from SQL with dated queries
- Session info in reports (
sessionInfo())
sessionInfo
print(sessionInfo())
Important interview questions and answers
- Q: Why renv?
A: Isolates project library from system R—like Python venv or node lockfiles. - Q: sessionInfo in reports?
A: Proves R version and loaded packages at render time.
Self-check
- What fixes random number streams?
- What command shows R and package versions?
Tip: Pair renv with Git and documented SQL extracts for audit trails.
Interview prep
- Why renv?
Pins exact package versions per project for CI and production reruns.