Using Rmarkdown for reproducible genomics research

Introduction
Analysis in R
Rmarkdown can be used to produce HTML reports with code
File structure setup
data vs. analysis directories
links to original data
Using sections

Managing package dependencies
A major challenge in repeating someone else’s analysis is the fact that they may have used previous versions of R or packages. So installing the latest versions of the package may or may not produce the same results, even if the same functions are called with the same parameters. Showing future users how to set up an R environment with the exact same versions will help others reproduce your findings with greater ease. The following text can be included in your Rmarkdown document. It shows how the renv environment was set up and how another users can use the renv file to re-install the same packages:
We first want to install all of the packages used in this analysis. We use the package renv as a way to manage package versions. The following code was initially run to set up the package library.
install.packages("renv")
library(renv)

```{r renv, eval = FALSE}
renv::init(bare = TRUE)
install.packages("BiocManager")
library(BiocManager)
install.packages(c("ggplot2", "magrittr", "knitr", "kableExtra", "ggrepel",
"stringr", "circlize", "ComplexHeatmap", "metap","limma",
"devtools", "rmarkdown", "formatR", "bitops", "caTools"),
repo = BiocManager::repositories())
renv::snapshot()
```

If you are attempting to reproduce this analysis, you can 1) install/load renv, 2) copy/paste the renv.lock file into your current working directory and 3) run the renv::restore() command to automatically install all of the packages with the same version.
Note: that you will need to change the list of packages that are listed in the “install.packages” command to be specific to your analysis project.
Including session information
In addition to using the renv package, it is conveniet to list the R version and package versions that were used at the time of the analysis. The sessionInfo() command can be used to simply list the details in the current environment:
image.png
image.png
3) Folder structure including a data folder and analysis folder. All relevant data files should be accessible via relative paths

4) Include links to publicly available files
5) Each section should have some description of what you are doing any why you are doing it (can copy from manuscript)
6) Include authors, date, and outline
7) The raw version of data analysis figures used in the paper should be available in the Rmarkdown.
8) potentially use rrtools
9) withr or set.seed for stochastic methods
Potentially include a template or example script?

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.