x <- c(
" hello world ",
" test case ",
"no space",
" multiple spaces "
)
remove_space(x)
remove_space(x, trim_start = FALSE)
remove_space(x, trim_end = TRUE)
remove_space(x, collapse_multiple = FALSE)
remove_space(
x,
trim_start = FALSE,
trim_end = FALSE,
collapse_multiple = FALSE
)
# with newlines
multiline <- c(
"hello\n\n world ",
" first \n second "
)
remove_space(multiline)
remove_space(multiline, preserve_newlines = FALSE)
Run the code above in your browser using DataLab