On Tue, 2007-10-16 at 07:49 -0700, Thomas Lumley wrote:
On Mon, 15 Oct 2007, Gabor Grothendieck wrote:
Here is an alternative:
sub(.*(..)$, \\1, x)
For sufficiently small values of 3 ;)
all.equal(2., 3)
[1] TRUE
;-)
Marc
__
Looks fine by me. There are lots of other ways of doing it. Does
this look any nicer?
x - c('asdfghk', 'qwerrey')
gsub(.*(...)$, '\\1', x)
[1] ghk rey
On 10/15/07, Sergio Correia [EMAIL PROTECTED] wrote:
I want to extract the last 3 letters of a string.
So far, I've done this:
symbol
I was hoping to avoid using regex except when necessary (u know what
they say), but I'm beginning to think that's the way things are done
in R.
Thanks
On 10/15/07, jim holtman [EMAIL PROTECTED] wrote:
Looks fine by me. There are lots of other ways of doing it. Does
this look any nicer?
x
3 matches
Mail list logo