cleanup_spaces {mclm} | R Documentation |
Clean up the use of whitespace in a character vector
Description
The function cleanup_spaces()
takes a character vector and input and turns
any uninterrupted stretch of whitespace characters into one single space character.
Moreover, it can also remove leading whitespace and trailing whitespace.
Usage
cleanup_spaces(x, remove_leading = TRUE, remove_trailing = TRUE)
Arguments
x |
Character vector. |
remove_leading |
Logical. If |
remove_trailing |
Logical. If |
Value
A character vector.
Examples
txt <- " A \\t small example \\n with redundant whitespace "
cleanup_spaces(txt)
cleanup_spaces(txt, remove_leading = FALSE, remove_trailing = FALSE)
[Package mclm version 0.2.7 Index]