Stripping either or both ends can be achieved by the somewhat tortuous but 
fairly general

stripspace<-function(x) sub("^\\s*([^ ]*.*[^ ])\\s*$", "\\1",x)

which uses a replacement buffer to keep the useful part of the string.

>>> Prof Brian Ripley <[EMAIL PROTECTED]> 06/08/2007 21:23:49 >>>
I am sure Marc knows that ?sub has examples of trimming trailing space and 
whitespace in various styles.


*******************************************************************
This email contains information which may be confidential and/or privileged, 
and is intended only for the individual(s) or organisation(s) named above. If 
you are not the intended recipient, then please note that any disclosure, 
copying, distribution or use of the contents of this email is prohibited. 
Internet communications are not 100% secure and therefore we ask that you 
acknowledge this. If you have received this email in error, please notify the 
sender or contact +44(0)20 8943 7000 or [EMAIL PROTECTED] immediately, and 
delete this email and any attachments and copies from your system. Thank you. 

LGC Limited. Registered in England 2991879. 
Registered office: Queens Road, Teddington, Middlesex TW11 0LY, UK

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to