From the course: R for Data Science: Analysis and Visualization
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Computing new variables - R Tutorial
From the course: R for Data Science: Analysis and Visualization
Computing new variables
- [Instructor] So, I should probably be a little more explicit about some of the things that you've already seen me do, and I may have explained a little bit, and that's about creating new variables in R, and this is actually a really simple process when you use the Tidyverse approach. Let me show you how this works and do some common tasks in working with data of the kind that I'm accustomed to. So, I'm going to just load the Tidyverse, and what I'm going to do then is I'm going to create a little toy data set with three variables. I'm going to save it as a tibble, that's a kind of data frame that is used in the Tidyverse, it makes certain things easier, and I'm going to have X be the values 1 through 5, I'm going to have Y be the value is 7 going down to 3. And then for Z, third one, I'm using the C for concatenate combined, and then I just typed in a few different values, a 2, a 4, a 3, a 7, and then an NA, which…
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.