Getting Up and Running with R

Getting Up and Running with R#

In this session we are going to cover some background to R and Rstudio and provide you with a guided tour of RStudio. We assume that you already have both of these installed on your machines.

Learning Objectives#

  • Learn the reasons why R is a popular programming language for statistical analysis and its application in various scientific fields

  • Gain an understanding of what R and RStudio are, including their roles in programming and code development

  • Familiarize yourself with the RStudio interface, including its four main panes and their functionalities

  • Learn how to customise the RStudio layout to enhance coding efficiency and convenience

  • Develop the ability to write and execute basic commands in R using RStudios console and script editor

Why R?#

R is a free software program primarily used for statistical analysis. It has become incredibly popular, particularly in biological sciences.

The basis of programming is that we write down instructions for the computer to follow, and then we tell the computer to follow those instructions. We write, or code, instructions in R because it is a common language that both the computer and we can understand. We call the instructions commands and we tell the computer to follow the instructions by executing (also called running) those commands.

Some reasons for it’s popularity are:

  • it’s free, well-documented, and runs almost everywhere

  • it has a large (and growing) user base among scientists

  • it has a large library of external packages available for performing diverse tasks

  • it is a gateway into other programming languages

Tip

This is a great point you as a learner to reflect on why you are here, how will R help you with your research or daily activities?

We should also note that, the two most important reasons for choosing a language are to use whatever language your colleagues are using, so you can share your work with them easily, and to use that language well.

What are R and RStudio?#

R is the programming language that we use to tell the computer what to do.

RStudio, is an Integrated Development Environment (IDE) that provides an interface designed to improve the experience of programming with R, and to facilitate more efficient and reproducible code development. It is designed so you can have multiple elements visible at the same time within a single programme. For example plots, tables and code, rather than juggle different programmes or windows.

We will use RStudio IDE to write code, navigate the files found on our computer, inspect the variables we are going to create, and visualize the plots we will generate. RStudio can also be used for other things (e.g., version control, developing packages, writing Shiny apps, creating documents and slides) that we will not cover during the workshop. It can be a very powerful tool for managing how you develop code, software or programmes.