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

an object with typeof being character

Details

Function trimws_ is more aggressive than trimws, that it removes

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]