[R] Removing trailing spaces

Patrick Connolly p.connolly at hortresearch.co.nz
Wed Dec 22 00:26:37 CET 2004

On Tue, 21-Dec-2004 at 05:19PM -0600, Marc Schwartz wrote:

|> On Wed, 2004-12-22 at 11:38 +1300, Patrick Connolly wrote:
|> > Some years ago when I used S-PLUS, I seem to remember, there was a
|> > discussion about a simple method of removing trailing spaces from
|> > vector elements.  I'd be fairly sure the same would work in R, but I
|> > can't find any mention of anything like it in the R archives or with
|> > help.search().
|> > 
|> > There are ways I could do it with substring(), but I seem to remember
|> > there was something more elegant.  I can find the strip function in
|> > the clim.pact package, but that trims everything after the first space
|> > which is not useful in this case.
|> > 
|> > Someone please refresh my memory.
|> > 
|> > TIA
|> See the final examples in ?sub

Yes.  Thanks.  I knew it was something very simple. 

Patrick Connolly
Mt Albert
New Zealand 
Ph: +64-9 815 4200 x 7188
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright 

More information about the R-help mailing list