removeSpace | R Documentation |
Remove leading and/or trailing white space from character strings
removeSpace(x, begin = TRUE, end = TRUE, all = FALSE, ...)
x |
Character string, can be a vector |
begin |
Logical. Remove leading spaces at the beginning of the character string? DEFAULT: TRUE |
end |
Logical. Remove trailing spaces at the end? DEFAULT: TRUE |
all |
Logical. Remove all spaces anywhere in the string? DEFAULT: FALSE |
... |
Further arguments passed to |
Character string (vector)
If all arguments are FALSE, the string is returned unchanged.
Not
extensively tested yet, please mail me any problems...
Berry Boessenkool, berry-b@gmx.de, Dec 2014
sub
, trimws
since R 3.2.0 (April 2015)
s <- c("space at end ", " white at begin", " both ", " special ^ ")
removeSpace(s)
trimws(s)
# To add space, use:
x <- c("ab","abcde")
format(x)
format(x, justify="centre")
format(x, width=9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.