trim | R Documentation |
Remove leading and/or trailing white space from character vectors.
trim(s, leading = TRUE, trailing = TRUE, perl = TRUE, ...)
s |
a character vector |
leading |
logical |
trailing |
logical |
perl |
logical |
... |
arguments passed to |
trim
removes leading and trailing space, which is defined
through the (Perl) regular expression \s
.
The base package has a function trimws
these days,
so you may not actually need the function (any more).
a character vector
Enrico Schumann
trimws
, gsub
, strtrim
s <- c("\t 2 2\n \t", " ab ")
trim(s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.