Programming using R

This is a one day intensive course on R programming techniques. The course is structured as a set of lecture sessions and computer practicals. It mainly covers the basic programming tools in R, such as functions and control structures, i.e. conditional expressions and loops. This course might be benfecial for a wide range of participants e.g., statisticians, biologists, clinicians and postgraduate students.

NOTICE

This course assumes all participants have basic concepts of R, as covered by the 'Introduction to R' course. It is highly recommended that a participant attends the 'Introduction to R', followed by this course. Both courses together form a series titled 'Mastering Data Analysis & Visualisation Using R'.

COURSE OUTLINE

  • Functions: What is an R function?, how are they structured and used?, how can one understand function’s parameters and how can we create our own functions?
  • Control Structures: Describing how we include control structures into R code.
  • Conditional expressions: Using “if” and “ifelse” structures in R.
  • Loops: Introcuding looping techniques in R, with particular focus on “for”, “repeat” and “while” statements.
  • “apply” family: using “apply”, “lapply”, “tapply”, “mapply” and “sapply” in R.

PRESENTER

Dr. Osama Mahmoud, Senior Research Associate in Medical Statistics, School of Social and Community Medicine, University of Bristol, UK.

INSTALLING THE R PACKAGE

Each course is associated with an R package tailored to combine together the practical sheets with solutions, course notes and training data sets. The R package associated with this course, named 'sscmRprogramming', can be simply installed by running the following code lines into your R session.

install.packages("drat")
drat::addRepo("statcourses")
install.packages("sscmRprogramming", type="source")

The package can then be loaded via:

library("sscmRprogramming")