R primer for omics
2025-09-22

Chapter 1 Introduction

This course will teach you the fundamentals of R, an essential skill for some of our future courses. The first day will focus on the basics of R with foundations and objects and covers chapters 1-6. In day 2 we will cover chapters 7-12. We will look at how to read in files and write out files from R. Additionally, you will get further practice on the previous materials whilst learning some handy tips and tricks.
Learning outcome
At the end of the course learners will be able to:
- Create, edit, run, and save R scripts with RStudio.
- Understand and use fundamental R concepts including operators, annotations, variables, and functions.
- Utilise a variety of R functions.
- Explain the difference between the R classes; Integer, Double, String, and logical.
- Utilise the different R structures; Scalars, Vectors, and Data frames.
- Read in data from files to R and write out data from R to files.
- Subset and manipulate R vectors and data frames with indexing.
Extra materials
There are extra materials you can attempt after the workshop (chapters 13-21). These will allow you to apply your R skills to create plots and carry out some statistics. The plots section includes creating line graphs, histograms, scatterplots, and boxplots. The statistics section will cover carrying out some basic statistics, don't worry it won't be a statistics lesson. Finally, the last section will introduce some harder coding where you'll learn to make loops, use ifs, and create R functions.
Material contents
These materials will involve theory, practice, exercises, and solutions:
- The theory will explain R concepts and terminology. R terminology can be quite confusing but it is important to learn as it makes asking questions online a lot easier.
- Practice will involve code to run whilst reading through the theory. This will allow you to see the output of R and hopefully help you understand how R works.
- Multiple choice questions (MCQs): These will be used as recap questions at the end of chapters to help solidify the knowledge you are gaining.
- Exercises will give you a task to carry out based on the knowledge and skills you learned from the theory and practise.
- Solutions for the exercise are after the exercise. Please try the exercise before looking at the solutions, however make sure you read the solutions even if you completed the exercise successfully as there is extra information in these sections.
Commands are in the following font and colour and should be run in RStudio (These should not be copied into R from this document):
Table of contents
Foundations | R objects |
![]() |
![]() |
Files & subsetting data | Handy tips & tricks |
![]() |
![]() |
Histograms & line graphs | Scatter plots & box plots |
![]() |
![]() |
Basic stats | Basic programming |
![]() |
![]() |
Appendix | |
![]() |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.