> How to trim the leading and trailing white space off of a string?
>
> If the variable is " E " I need to convert it to "E".
gsub('^[[:space:]]+', '', " E ")
gsub('[[:space:]]+$', '', " E ")
as in R-2.1.0/library/base/html/grep.html