Subsetting Data in R with Square Brackets and Logic Statements: (R Tutorial 1.6)
In this video you will learn to use the 'square brackets' to create subsets of data, based on values of some of the variables in the dataset.
Here, we will show you how to ask R about the dimensions of the data using the "dim" or dimensions command, ask about the number of observations in a vector or variable using the "length" command, use square brackets "[ ]" on a single variable to extract part of the data, extract (subset) data from a matrix or data frame based on the values of some variables in R using square brackets (step by step examples), learn the difference between "=" (equal sign) and "==" (double equal sign) in R, and finally how to pull out a subset of data from a dataset by following a step by step example.
We recommend using the link below to download the dataset and practice on your own while watching this tutorial.
You can access and download the dataset that was used in this tutorial here: