From the course: Learning the R Tidyverse

Unlock the full course today

Join today to access over 24,100 courses taught by industry experts.

Cleaning column names with the janitor package

Cleaning column names with the janitor package - R Tutorial

From the course: Learning the R Tidyverse

Cleaning column names with the janitor package

- [Instructor] I need to show you both an annoying real world problem and a solution to that in the same video. To do so, we are in 0204B, and we're taking a look at the clean names.r script. Let's load the tidyverse on line one and we'll read in our dataset on line three. And let's print that dataset to the console. I want to take a look at those column names, and those are some pretty messy column names. We've got spaces in them, we've got inconsistent capitalization, and this column here, source year one, we've got brackets in it as well. It would be really frustrating to work with these columns as they are. So if I were to pipe UN data into select and I wanted that country or area column, I would need to type back ticks. So I would need to write country, or area, and select the column like that because of the spaces in the column names. So there's a package that can help with this called janitor. Janitor isn't in the tidyverse, so we need to install it separately. And remember my…

Contents