See the original description in base::trimws.
base::trimws
trimws(x, which = c("both", "left", "right"))
x
See description.
which