R is a programming language which allows us to give instructions to the computer. These instructions can be as simple as "add together these two numbers" or as complex as "give me the average CO2 concentration for 2020". For the former we will be able to complete the task using only a single instruction but for the latter, we may have to write a larger program containing hundreds or thousands of instructions.
This course is going to start from the beginning, showing you to talk to the computer to perform simple tasks. This course does not assume any knowledge of programming. Indeed, this course is designed for people who are completely new to programming. The aim is to introduce you to enough of the R programming language, that, as you become more confident and follow the later courses (e.g. Intermediate R and Introduction to Data Analysis with R), you will find that you are able to write much more complex programmes and understand how to exploit the power of R for data analysis and visualisation.
R is a well-established language, initially released in 1995 (with version 1.0 in 2000), and the latest release (4.0.2) released in 2020. R is a general programming language, but has found particular application in statistical and data driven programming. It has become the de facto standard programming language of data science.
R is available for all operating systems, including Windows, OS X and Linux. It is not installed by default. It is typically installed as part of an R programming environment, e.g. RStudio, the Open Source version of which can be downloaded from here.
This workshop is going to introduce you to the basics of the R programming language with more advanced topics being covered by later workshops.
You can jump ahead to any chapter (and pre-recorded video walkthroughs of each chapter is avaiable at the link):
To follow this workshop you must install both R and RStudio. Instructions to do this are below. Videos demonstrating installation on Windows 10, Ubuntu Linux and macOS Catalina are here;
Because R is not installed by default on most computers, you will need to download and install it before continuing with this workshop. R is available for many operating systems, including Windows, Linux and OS X. You will need administrator access to install R on your computer. If you don't have administrator access, then your IT Services may have made it available via a software catalogue or software center. If not, then get in contact with your IT Services to install R.
If you have administrator access or elevated user rights, you can download and install R by following the links on this page. For convenience, the download links are;
Follow the instructions on those pages to download and install R.
There are lots of different ways to run R code and many tools to help you write it. You don't require any special tools to create a R script, a simple text editor like Notepad on Windows is sufficient. More advanced tools include things like Jupyter Notebooks and IDEs like RStudio or Visual Studio Code.
For this workshop we will be keeping things as simple as possible in order to allow us to focus on the topics we're learning without having to learn too many extra tools along the way.
For the purpose of this course we will be using a free and open source version of RStudio. This provides a graphical interface with a local text editor, interface to the operating system terminal, and an interactive R console. Again, you need administrator access or elevated user rights to install RStudio on your computer. If you don't have this, then your IT Services may have made RStudio available via a software catalogue or software center. If not, then get in touch with your IT Services to install RStudio for you.
If you do have administrator access or elevated user rights, then the easiest way to get access to RStudio is to download the free "open source edition" of "RStudio Desktop" from the website, and to then follow the instructions on the website to install the version that is appropriate for your operating system.
Once RStudio is installed, start it by double-clicking on the "RStudio" icon. This should open a window that looks something like this;