Re: [R] Remove leading and trailing white spaces

2012-03-20 Thread Daniel Malter
This just saved me a lot of time. Thank you! Daniel -- View this message in context: http://r.789695.n4.nabble.com/Remove-leading-and-trailing-white-spaces-tp907851p4489725.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-proj

Re: [R] Remove leading and trailing white spaces

2009-11-20 Thread Gabor Grothendieck
See: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/40714.html There are many packages which have this functionality as well and a search (??, RSiteSearch, rseek.org) will find them. The links box on the http://gsubfn.googlecode.com page has links to regular expression pages on the web. On Fri,

Re: [R] Remove leading and trailing white spaces

2009-11-20 Thread jim holtman
try this: > x <- ' middle of the string ' > sub("^[[:space:]]*(.*?)[[:space:]]*$", "\\1", x, perl=TRUE) [1] "middle of the string" On Fri, Nov 20, 2009 at 10:51 AM, Bos, Roger wrote: > I have a character string and I would like to remove the leading and > tailing white spaces.  The ex

[R] Remove leading and trailing white spaces

2009-11-20 Thread Bos, Roger
I have a character string and I would like to remove the leading and tailing white spaces. The example for 'sub' shows how to remove the trailing white spaces, but I still can't figure out how to remove both trailing and leading white spaces because I can't find any documentation for what "+$" mea