x <- " string "
# Example 1: Remove whitespace at both sides
chr.trim(x)
# Example 2: Remove whitespace at the left side
chr.trim(x, side = "left")
# Example 3: Remove whitespace at the right side
chr.trim(x, side = "right")
Run the code above in your browser using DataLab