trimws_ {ThomasJeffersonUniv} | R Documentation |
Remove Leading/Trailing and Duplicated (Symbols that Look Like) White Spaces
Description
To remove leading/trailing and duplicated (symbols that look like) white spaces.
More aggressive than function trimws.
Usage
trimws_(x)
Arguments
x |
Details
Function trimws_ is more aggressive than trimws, that it removes
-
duplicated white spaces
-
symbols that look like white space, such as
\u00a0
(no-break space)
Value
Function trimws_ returns an object of typeof character.
Note
gsub keeps attributes
Examples
(x = c(A = ' a b ', b = 'a . s', ' a , b ; ', '\u00a0 ab '))
base::trimws(x)
# raster::trim(x) # do not want to 'Suggests'
trimws_(x)
(xm = matrix(x, nrow = 2L))
trimws_(xm)
#library(microbenchmark)
#microbenchmark(trimws(x), trimws_(x))
[Package ThomasJeffersonUniv version 0.1.3 Index]