Re: [R] Get the last 3 chars of a string

2007-10-15 Thread Sergio Correia
t; 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 extra

[R] Get the last 3 chars of a string

2007-10-15 Thread Sergio Correia
I want to extract the last 3 letters of a string. So far, I've done this: > symbol = 'XYZ.VX" > substr(symbol,nchar(symbol)-2,nchar(symbol)) [1] ".VX" It works, but the code looks UGLY as hell. Am I missing something? Or is this the way it's supposed to be? Thanks, Sergio On 10/15/07, pintinho

Re: [R] How to create something between a script and a package

2007-10-09 Thread Sergio Correia
Mark, Moshe, Vladimir, Uwe, Thanks for the tips regarding -source- and -rprofile-. Best, Sergio On 10/9/07, Uwe Ligges <[EMAIL PROTECTED]> wrote: > > > Sergio Correia wrote: > > (Before starting: I'm a total R noob so please bear with me in case of > > an

[R] How to create something between a script and a package

2007-10-08 Thread Sergio Correia
(Before starting: I'm a total R noob so please bear with me in case of any error or faux pas). Hi, For a small project, I'm writing a few simple R functions and calling them from python (using RPy). I'm sharing the code with a couple of friends, using a subversion server. Now, I want something l