concept trimws() in category R

appears as: trimws()
Exploring Data with R

This is an excerpt from Manning's book Exploring Data with R.

Some of the truncated strings above end with a space character (elements 2 and 4). We can remove, or trim, that whitespace with the trimws() function. Simply pipe the resto_reviews_trunc vector to trimws(), as in Listing 8.13, and all of the new strings won’t have any trailing whitespace (this also eliminates leading whitespace).