Statistical Computing (R Programming)

Course information

The course introduces learners to data visualisation, data management and programming in the statistical software environment R.

Prerequisite Knowledge

Learners require a basic understanding of matrix algebra. The course is suitable for learners with no prior experience in programming, however, learners with no prior experience in programming should expect a larger time commitment in order to fully benefit from the course.

This course is typically taken in year 1 of the MSc in Data Analytics/Data Analytics for Government programme.

This course assumes that you have comparative knowledge and skills covered in the following courses, alternatively, you may wish to consider taking some of the courses listed before attempting this course.

Intended Learning Outcomes

By the end of this course learners will be able to:

  • recognise and make appropriate use of different types of data structures;
  • manipulate data sets in R;
  • use R to create figures and graphs;
  • identify and implement appropriate control structures to solve a particular programming problem;
  • design and write functions in R and implement simple iterative algorithms;
  • structure complex programming problems into functional units and implement these;
  • carry out extended programming tasks and produce clearly annotated listing of their code;
  • author reports with embedded code using technologies such as Sweave or knitr;
  • develop and deploy R Shiny apps.

Syllabus

Week 1

  • Installing R and RStudio
  • Accessing R in the cloud
  • Basics of scientific computing
  • Variables and R as a calculator

Week 2

  • Logical operators
  • Vectors, lists and matrices
  • Other common data types

Week 3

  • Data frames
  • Transforming, subsetting and merging data frames
  • Reading/writing data from/to files

Week 4

  • Efficient data management using tidyverse
  • tibbles
  • Transforming, subsetting and merging data frames using dplyr
  • Reshaping data using tidyr

Week 5

  • R graphics
  • Data visualisation in R

Mid-term week break

Week 6 (sample material)

  • Advanced graphics using ggplot2

Week 7

  • if statements and ifelse
  • Using loops (for and while) for iterative and repeated computations

Week 8

  • Writing R functions
  • Structuring your code efficiently using functions
  • Debugging

Week 9

  • Basics of object-oriented programming
  • Creating classes (“S3”) in R
  • Creating R6 classes

Week 10

  • Authoring data-driven interactive webapps using shiny

Week 11

  • Authoring automatic reports using knitr and rmarkdown
  • Reproducible data science

“I really enjoyed the course and believe that the content goes into the perfect amount of detail with examples and everything is clearly explained. I like the videos that show the code in practice.”

Software

To take our courses please use an up-to-date version of a standard browser (such as Google Chrome, Firefox, Safari, Internet Explorer or Microsoft Edge) and a PDF reader (such as Acrobat Reader). Learning material will be distributed through Moodle. We encourage all learners to install R and RStudio and we provide detailed installation instructions, but learners can also use free cloud-based services (RStudio Cloud). Learners need to install Zoom for participating in video conferencing sessions. We recommend the use of a head set for video conferencing sessions.