Re: [R] trim function in R

2006-07-24 Thread Gesmann, Markus
See ?substr and ?nchar Try: substr(Hello World, 0, nchar(Hello World)-2) Regards Markus Gesmann FPMA Lloyd's Market Analysis Lloyd's * One Lime Street * London * EC3M 7HA Telephone +44 (0)20 7327 6472 Facsimile +44 (0)20 7327 5718 http://www.lloyds.com -Original Message- From: [EMAIL

Re: [R] trim function in R

2006-07-24 Thread Gabor Grothendieck
A . (dot) matches any character and $ matches the end of string so this replaces the last two characters with the empty string: sub(..$, , x) On 7/24/06, Wade Wall [EMAIL PROTECTED] wrote: Hi all, I am looking for a function in R to trim the last two characters of an 8 character string in