Reproducible Research in R
The Course
This course introduces R and statistical programming as well as best practices for reproducible research using R's dynamic reporting and version capture tools.
The course consists of 3 sections, 2 on basic R and 1 on reproducibility in R.
Each section is presented as both HTMl and Rpres markdown ( to allow for intergration of the presentation in the RStudion enviroment itself). Exercises and answer sheets are included after all subsections to practice techniques and provide future reference examples.
Course material and exercises are available to view as rendered HTML at https://lmsbioinformatics.github.io/LMS_Reproducible-R/.
All material is available to download under GPL v2 license.
For information on other courses run by our team see our github IO page.
The Team
This course was created and conducted by the MRC London Institute of Medical Sciences Bioinformatics Team at Imperial College London, Hammersmith Hospital.
For more information on the team see our github IO page.
This course is free for MRC LMS and Imperial staff and students. If you would like to attend a future course contact Contact Us.
Setting up.
Install R.
R can be installed from the R-project website.
R 4.1 or higher is required for this course.
Install RStudio.
RStudio can be installed from the R-project website.
Install required packages.
Option 1 - (For your own personal computers)
Having downloaded R and RStudio, some additional packages are required (rmarkdown and ggplot2).
To install these,
- First launch RStudio
- Install the packages in the R console using devtools
install.packages("devtools",dependencies=TRUE) devtools::install_github("LMSBioinformatics/LMS_Reproducible-R",subdir="reproducibleR",build_vignettes=TRUE)
Option 2 - (For Imperial Hammersmith library)
Having downloaded R and RStudio, some additional packages are required (rmarkdown and ggplot2).
To install these,
- First launch RStudio
- Install the packages in the R console using install.packages
install.packages("ggplot2",dependencies=TRUE) install.packages("rmarkdown",dependencies=TRUE) install.packages("yaml",dependencies=TRUE)
Download the material
The material can either be downloaded as a zip
wget https://github.com/LMSBioinformatics/LMS_Reproducible-R/archive/master.zip ./
or checked out from our Github repository https://github.com/LMSBioinformatics/LMS_Reproducible-R/
The R Sessions
Introduction to R, Session 1
This section focuses on R basics such as simple data types, data IO, plotting and statistics.
Session sections:
- Introduction to R
- Data Types
- Reading and Writing Data
- Loading libraries
Link to single page, printable HTML - Session 1
Introduction to R, Session 2
In session 2, programmatic techniques such as looping and use defined functions are introduced
The session includes longer exercises and shorter slide decks and so more time should be allocated to exercises in this session.
Session sections:
- Looping Conditional Branching
- Data Types
- Writing Scripts
- Getting
Link to single page, printable HTML - Session 2
Introduction to R, Session 3
In the Reproducible Reporting in R session, the use of dynamic documents is introduced with topics such as Markdown syntax, YAML headers and rmarkdown/knitr documen rendering functions
Session sections:
- Creating reports from R scripts
- Markdown Syntax
- Markdown in R
Link to R code included in presentation- - Session 3