R for Sport Scientists – Fundamentals Course
Lecture 4: Subsetting
Subsetting (or indexing) allows you to extract or replace parts of the objects. There are three subsetting operators in R:
$, [, and [[.
Although R is very flexible in achieving these objectives, it can have its quirks particularly since the same subsetting methods can yield different results with different object types (i.e., when dealing with missing values, out of bounds indexes, and so forth).
In this lecture, I will explain to you how subsetting works, how you can replace (i.e., assign) parts of the object, remove parts, append objects, order, and filter. These operations are one of the most important ones in any analysis that you might perform later.
This lecture consists of four videos. Make sure to download the R script below which you can use to follow the lectures.