UiB Blogg            

R-course for bio-scientists

Photo: Colourbox

Dates: 3-7 May, 2021
Location: The course is given online.
Lecturers: Kornel Labun, Eivind Valen, Håkon Tjeldnes, Adnan Niazi
Credits: 3 ECTS
Registration: HERE. NORBIS members will be prioritized. UPDATE: Please note the course is full, and new registrations are put on the waiting list.


Course description:

The R crash course is an introductory course and no previous knowledge about programming is necessary for participation. It extends over five days, from 9-16. You will learn how to get started with R, how to make small useful programs, how to analyze your data in reproducible ways, how to visualize your dataset with beautiful plots and how to take advantage of thousands of R packages. The course is biology-oriented, and will introduce you to the wonders of Bioconductor. We will also expect you to complete a few homework assignments to practice and hone your skills. The R crash course is adapted from Software Carpentry workshops, and we expect a high level of interaction and hands-on exercises. 

Course material is available here: r-crash-course.github.io


Course program:

Day 1

  1. R + Rstudio installation (60 min)
  2. Interface of Rstudio (45 min)
    1. Describe the purpose and use of each pane in the RStudio IDE
    2. Locate buttons and options in the RStudio IDE
    3. Define a variable
    4. Assign data to a variable
    5. Manage a workspace in an interactive R session
    6. Use mathematical and comparison operators
    7. Call functions
    8. Manage packages
  3. Exercises (30 min)
  4. Create self-contained projects in RStudio (15 min) 
  5. Exercises (30 min)
  6. Lunch Break (30 min)
  7. Seeking Help (20 min)
    1. To be able read R help files for functions and special operators.
    2. To be able to use CRAN task views to identify packages to solve a problem.
    3. To be able to seek help from your peers.
  8. Exercises (30 min)
  9. Data Structures (40 min)
    1. To be aware of the different types of data.
    2. To begin exploring data frames, and understand how they are related to vectors, factors and lists.
    3. To be able to ask questions from R about the type, class, and structure of an object.
  10. Exercises (120 min)

Day 2

  1. Exploring Data Frames (30 min)
    1. Be able to add and remove rows and columns.
    2. Be able to remove rows with NA values.
    3. Be able to append two data frames
    4. Be able to articulate what a factor is and how to convert between factor and character.
    5. Be able to find basic properties of a data frames including size, class or type of the columns, names, and first few rows.
  2. Exercises (30 min)
  3. Subsetting Data (30 min)
    1. To be able to subset vectors, factors, matrices, lists, and data frames
    2. To be able to extract individual and multiple elements: by index, by name, using comparison operations
    3. To be able to skip and remove elements from various data structures.
  4. Exercises (45 min)
  5. Control Flow (45 min)
    1. Write conditional statements with if() and else().
    2. Write and understand for() loops.
  6. Lunch break (30 min)
  7. Exercises (90 min)
  8. Creating Publication-Quality Graphics (60 min)
    1. To be able to use ggplot2 to generate publication quality graphics.
    2. To understand the basic grammar of graphics, including the aesthetics and geometry layers, adding statistics, transforming scales, and coloring or panelling by groups.
  9. Exercises (60 min)

Day 3

  1. Vectorization (30 min)
    1. To understand vectorized operations in R.
  2. Exercises (30 min)
  3. Functions Explained (60 min)
    1. Define a function that takes arguments.
    2. Return a value from a function.
    3. Check argument conditions with stopifnot() in functions.
    4. Test a function.
    5. Set default values for function arguments.
    6. Explain why we should divide programs into small, single-purpose functions.
  4. Exercises (60 min)
  5. Lunch break (30 min)
  6. Writing Data (30 min)
    1. To be able to write out plots and data from R.
  7. Exercises (60 min)
  8. Split-Apply-Combine (30 min)
    1. To be able to use the split-apply-combine strategy for data analysis.
  9. Exercises (90 min)

Day 4

  1. Dataframe Manipulation with dplyr (60 min)
    1. To be able to use the six main dataframe manipulation ‘verbs’ with pipes in dplyr.
    2. To understand how group_by() and summarize() can be combined to summarize datasets.
    3. Be able to analyze a subset of data using logical filtering.
  2. Exercises (120 min)
  3. Lunch break (30 min)
  4. Dataframe Manipulation with tidyr (30 min)
    1. To understand the concepts of ‘long’ and ‘wide’ data formats and be able to convert between them with tidyr.
  5. Exercises  (45 min)
  6. Short about style (15 min)
  7. Producing Reports With knitr (30 min)
    1. Value of reproducible reports
    2. Basics of Markdown
    3. R code chunks
    4. Chunk options
    5. Inline R code
    6. Other output formats
  8. Exercises (90 min)

Day 5

  1. Making use of Bioconductor (180 min)
    1. Installation of Bioconductor packages
    2. Understanding IRanges
    3. Understanding GRanges
    4. Loading up fastq files into R, ShortRead
    5. Aligning reads using Biostrings
    6. Plotting using ggbio
  2. Lunch break (30 min)
  3. Exercises (120 min)
  4. Writing Good Software (10 min)
  5. Specific packages students are interested in
  6. Explanation of homework assignment


Learning outcomes and competence

After the course students will become proficient programmers in R. Students will become familiar with several CRAN and Bioconductor R packages. Also, self-learning of new R packages and programming skills should become feasible as the steepest, beginner level knowledge gap will be filled with this course. Each student should be able to approach problems in an algorithmic fashion, deconstruct seemingly difficult issues into smaller steps that can be solved with the use of basic knowledge. Students will become able to conduct typical bioinformatics tasks with understanding of underlying principles. Students will also be able to transition their knowledge to other programming languages (eg. python, java) and may benefit from programming skills in their non-scientific life.



– Bring your own laptop.

– Install R (can be downloaded here) and Rstudio (an environment for developing using R, download here).