From the course: Data Wrangling in R
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
Manipulating strings in R with stringr
From the course: Data Wrangling in R
Manipulating strings in R with stringr
- [Instructor] Data wrangling often includes performing quite a bit of work with strings. Let's take a look at how you can trim, edit, search and replace strings using the stringr library. Now, before we get started, one important note: stringr is part of the tidyverse, but like Lubridate, it's not one of the core tidyverse packages. This means that it was installed when you installed the tidyverse, but it needs to be loaded separately. One common operation in string manipulation is converting the case of a string. You might already be familiar with three different cases: Uppercase strings have all uppercase characters, and you can convert a string to uppercase by using the str_to_upper() function. Similarly, lowercase strings have all lowercase characters and you can convert a string to lowercase by using the str_to_lower() function. Finally, title case strings capitalize the first letter of each word, and you can convert…
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.