Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Strings basics
Regular expressions
Modifying strings
19. Replace a pattern in a string
Summary

Instruction

That worked, but we need something that can handle a more complicated task. Let's get rid of all the digits in the address.

Remember the [[:digit:]] expression? It can remove one digit at a time, but we want to remove several. To do this we'll use the similar function to sub()gsub() ("g" stands for global). It has identical syntax, so we'll use it like this:

clients$clean_addresses <- gsub("[[:digit:]]", "", clients$addresses)

Exercise

Use the gsub() function to remove all digits from the clean_names column. Assign the result to the clean_names column and take a look at that column using the head() function.