From the course: R for Data Science: Analysis and Visualization
Unlock the full course today
Join today to access over 25,000 courses taught by industry experts.
Recoding variables - R Tutorial
From the course: R for Data Science: Analysis and Visualization
Recoding variables
- [Instructor] The data rule of thumb is that 80% of any project time is spent preparing the data, and one of the major tests that can be included in that is recoding the data, so taking it as existing categories or scores and creating new categories or scores based on that, and I want to show you a few ways of doing this very briefly in R. We're going to do this by opening up 04_02_Recoding.R, and we're going to be using two packages. Number one is the general purpose tidyverse, 'cause that makes a lot of other functions possible, so we're going to load that one. We've installed it before. The other one is readxl. Now, interestingly, this is part of the tidyverse, but it's not loaded by default. You have to load it explicitly, and so I'm going to load that one as well, and it's an improved way of reading CSV and Excel files. So the first thing we're going to do is we're going to read our dataset in. Now, we're going to do a couple of things here. We're going to use the read CSV…
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.