[R] trim function in R

Wade Wall wade.wall at gmail.com
Mon Jul 24 15:42:29 CEST 2006


Hi all,
I am looking for a function in R to trim the last two characters of an
8 character string in a vector.  For example, I have the codes
37-079-2, 370079-3,37-079-8 and want to trim them to 37-079 by
removing the last two characters.  Is sub the correct function to use,
and if so how can I specify trimming the last 2 characters?  I have
read the help file, but can't quite figure out how to do it.
Thanks,
Wade



More information about the R-help mailing list