gsub(pattern = " ", # a space character
replacement = "", # empty string
x = c("Bill ", "Sally ", " Joe"), # the vector to match
ignore.case = FALSE,
perl = FALSE,
fixed = FALSE,
useBytes = FALSE
)
[1] "Bill" "Sally" "Joe"