When doing data cleaning, we often have to clean up strings of text. Doing this in R used to be a pain until the birth of the stringr package. For example, it contains a function called str_trim() that allows you to easily remove any leading and trailing whitespace of a string. It also contains a function called str_sub() that allows you to easily extract substrings from any string. Run the following code to see these two functions work.
You can learn other handy functions in the stringr package here