Description Usage Arguments Value Examples
The function cleanup_spaces
takes as its input a character vector
x
, and returns a copy of x
in which the use of whitespace
characters has been ‘normalized’. More specifically, this
‘normalization’ entails that each uninterrrupted stretch of whitespace
characters,
i.e. each sequence of one or more consecutive whitespace characters,
is replaced by a single SPACE character. Moreover, in case of the argument
specification
remove_leading = TRUE
, all leading whitespace is removed, and
in case of the argument specification
remove_trailing = TRUE
, all trailing whitespace is removed.
1 2 3 | cleanup_spaces(x,
remove_leading = TRUE,
remove_trailing = TRUE)
|
x |
the argument |
remove_leading |
in case of the setting |
remove_trailing |
in case of the setting |
Returns a character vector that is a copy of x
in which all whitespace is
‘normalized’.
1 2 3 | txt <- " A \t small example \n with redundant whitespace "
cleanup_spaces(txt)
cleanup_spaces(txt, remove_leading = FALSE, remove_trailing = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.