From the course: Data Wrangling in R
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Subsetting tibbles
- [Instructor] Analysts often need to extract a single variable from a tibble for further use in their analysis. This is an observation called subsetting. When we subset a tibble, we extract a single variable from that tibble in the form of a vector. We can do this without actually storing separate vectors in R by using a few special operators. The first way that we can do this is using the dollar sign operator. You simply type the name of the tibble, then the dollar sign, then the name of the variable that you'd like to extract. For an example, let's return to R. Here, I have RStudio still set up the way we left it in the last video. I have the people tibble that contains the name, birth years and eye colors of five people. Let's say I just want to see the list of eye colors without any of the other data. I can type in people, dollar sign, eye color, and then I get that vector. I can also use this vector inside of…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.