This workshop is aimed towards biologists, and other life sciences researchers with none or limited experience with R programming or even programming in general.

 

Preparation

Tools

  Install R statistical software

If you have an old version of R and you do not use it, uninstall it and then install a newer version. If you prefer to keep your old R version, then you can still install a newer version for this workshop. This is easy on Windows, but can be tricky on Linux.

Go to r-project.org and choose the link appropriate for your operating system.

Installation details

Windows: Click Download R for Windows > base > Download R X.X.X for Windows. This should download an .exe file. It is recommended that you DO NOT install to C:\Program Files\R\. Instead, install to C:\R\. It is also recommended that you install Rtools for building R packages from source code. Click Download R for Windows > Rtools.

Mac: Click Download R for (Mac) OS X > R-X.X.X.pkg that will download R to your computer. If you are not sure what version of Mac OS you are running, click the apple on the top left of your screen and select About this mac (Om den här datorn). In case you are running something older than 10.9, you should instead pick the “R-X.X.X-snowleopard.pkg” to install. Note that this will not give you the latest version of R, but it will be sufficient for most sections of the course. You can then double-click the downloaded package that will prompt you with some questions for installation details. Stick with the default settings and you should be fine.

Linux: Click Download R for Linux then pick your distribution of Linux. On most distributions, this will be via a software install system like yum or apt-get. If you run this make sure that you update your information to the installer first, otherwise you might end up installing at outdated version of R. For some systems you might need to install not only r-base, but also r-devel or you will lack important features of your R installation. When installing R packages, you might need to install OS specific packages before. These are displayed during R package installation.

  Install RStudio. Choose based on your OS.

RStudio provides you with tools like code editor with highlighting, project management, version control, package building, debugger, profiler and more. Start up RStudio to check that everything has been installed correctly. If not, contact us and we can help you out.

You can also watch this video for an introduction to using RStudio

  Install R packages

Please download this test_installation.Rmd file and Knit/Render it by clicking on the knit/render icon on the upper right of R Studio or by navigating to file > knit document.
After rendering if everything goes well you should see this message towards end of the rendered html file:

  • Congratulations you have installed all the packages.

If there are any missing packages they will be printed at the end of the rendered html file.

Syllabus

The syllabus for this workshop are as follows.

  • General introduction to programming and R.
  • R environment and RStudio IDE.
  • Data types.
  • Variables and operators.
  • Input/Output.
  • Control structures.
  • Functions and variable scope.
  • Base and ggplot2 graphics.
  • Overview of R package anatomy.
  • Brief introduction to Tidyverse.
  • Brief introduction to RMarkdown.

Learning outcomes

  • Feeling comfortable while working with R in RStudio.
  • Being able to read some data and perform basic data manipulation in R.
  • Being able to perform some basic analysis and generate plots in R.
  • Being able to generate a simple report.