Introduction to R

This is a short introduction to R for students with no experience in the language, or possibly any computer programming language.

This practical activity is scheduled to take roughly two hours after installation of R and RStudio applications on every student computer.

Prerequisites

R and R Studio should be installed (see the setup for instructions).





Schedule

Time Topic Learning Objectives
Before start Setup
09:00 Getting started with R and RStudio
  • Understand and describe two ways of using R interactively: The R console and RStudio
  • Be able to create an R script in RStudio and send R commands to the R console
  • Be able to use the basic R help system in R and RStudio
09:20 Basic R language syntax
  • Use basic R syntax to create variables, inspect functions, and write functions
  • Understand the use of parameters in functions, including named parameters and default parameters
  • Distinguish basic R data types
09:45 R data types
  • Recognise and the different basic data types in R.
  • Be able to index and subset different classes of data in R.
  • Be able to read in and explore data in data frames
10:10 R packages and the environment
  • Be able to identify installed packages and install new packages in R
  • Distinguish between namespaces and packages
10:30 coffee break Break
10:45 Logical and arithmetic operations
  • Be able to perform basic arithmetic in R using standard symbols.
  • Be aware of different logical tests in R.
  • Perform value matching using %in% and grep, knowing the difference between the two operations.
11:05 Let's do it again: using loops
  • Write and use basic loop structures for performing repetitive computations.
  • Become aware of the functional alternatives to control structures.
11:30 Working with data
  • Be able to perform a wide range of basic statistical computations in R.
  • Be able to extend, using lessons taught earlier on the use of apply, basic statistics function that use a numeric vector as an input to numeric data frames and matrices.
  • Be aware of the importance of knowing the data at hand, including the nature of the data one is working with.
12:00 Finish