trim {gdata} | R Documentation |
Remove leading and traling spaces from character strings
trim(s)
s |
object to be processed |
trim
is a generic function, where default method does nothing,
while method for character s
trims its elements and method for
factor s
trims levels
. There are also methods for
list
and data.frame
.
s
with all leading and traling spaces removed in its elements.
Gregory R. Warnes warnes@bst.rochester.edu
s <- " this is an example string " trim(s) f <- c(s, s, " A", " B ", " C ", "D ") trim(f) l <- list(s=rep(s, times=6), f=f, i=1:6) trim(l) df <- as.data.frame(l) trim(df)