trimws {memisc} | R Documentation |
trimws
returns a character string with leading and/or trailing
whitespaces removed. This is just a shorthand for an appropriate call to sub.
trimws(x,left=TRUE,right=TRUE)
x |
a character vector |
left |
logical, if TRUE leading whitespace is removed |
right |
logical, if TRUE trailing whitespace is removed |
The character vector x
with whitespace removed.
teststr <- c(" Hello World! ","I am here. ") trimws(teststr) trimws(teststr,left=FALSE) trimws(teststr,right=FALSE)