strtrim in r
The strtrim
function in R is used to trim leading and trailing whitespace from a character string. The function takes three arguments: x
which is the character vector to be trimmed, width
which is the maximum width of the output, and side
which specifies whether to trim from the left, right, or both sides of the string. If width
is not specified, the default is to remove leading and trailing whitespace. If side
is not specified, the default is to trim from both sides. The function returns a character vector of the same length as x
, with leading and trailing whitespace removed according to the specified width
and side
parameters.