remove all trailing whitspaces R code example Example: remove all trailing whitspaces R x = " string " trimws(x) x # [1] "string"